tree-loop-linear.c [plain text]
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "errors.h"
#include "ggc.h"
#include "tree.h"
#include "target.h"
#include "rtl.h"
#include "basic-block.h"
#include "diagnostic.h"
#include "tree-flow.h"
#include "tree-dump.h"
#include "timevar.h"
#include "cfgloop.h"
#include "tree-fold-const.h"
#include "expr.h"
#include "optabs.h"
#include "tree-chrec.h"
#include "tree-data-ref.h"
#include "tree-scalar-evolution.h"
#include "tree-pass.h"
#include "varray.h"
#include "lambda.h"
void
linear_transform_loops (struct loops *loops)
{
unsigned int i;
for (i = 1; i < loops->num; i++)
{
struct loop *loop_nest = loops->parray[i];
varray_type oldivs;
varray_type invariants;
lambda_loopnest before, after;
lambda_trans_matrix trans;
if (!loop_nest->inner)
continue;
flow_loop_scan (loop_nest, LOOP_ALL);
flow_loop_scan (loop_nest->inner, LOOP_ALL);
#if 0
if (loop_nest->num_pre_header_edges != 1
|| loop_nest->inner->num_pre_header_edges != 1)
continue;
#endif
before = gcc_loopnest_to_lambda_loopnest (loop_nest, &oldivs, &invariants);
if (!before)
continue;
if (dump_file)
{
fprintf (dump_file, "Before:\n");
print_lambda_loopnest (dump_file, before, 'i');
}
trans = lambda_trans_matrix_new (LN_DEPTH (before), LN_DEPTH (before));
#if 1
lambda_matrix_id (LTM_MATRIX (trans), LN_DEPTH (before));
#else
LTM_MATRIX (trans)[0][0] = 0;
LTM_MATRIX (trans)[0][1] = 1;
LTM_MATRIX (trans)[1][0] = 1;
LTM_MATRIX (trans)[1][1] = 0;
#endif
after = lambda_loopnest_transform (before, trans);
if (dump_file)
{
fprintf (dump_file, "After:\n");
print_lambda_loopnest (dump_file, after, 'u');
}
lambda_loopnest_to_gcc_loopnest (loop_nest, oldivs, invariants,
after, trans);
}
}