summaryrefslogtreecommitdiff
path: root/gcc/tree-loop-linear.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-28 04:19:26 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-28 04:19:26 +0000
commit41c7a32495cd3504d8df84dda26c4c5d1de25185 (patch)
tree29bb0dc8b58695cd2522e866ebb0a5c9b775a9e4 /gcc/tree-loop-linear.c
parent12de5dc01f0a893a14554bb32e7bea2abd154210 (diff)
downloadgcc-41c7a32495cd3504d8df84dda26c4c5d1de25185.tar.gz
* tree-loop-linear.c: Don't include varray.h.
(gather_interchange_stats, try_interchange_loops, linear_transform_loops): Use VEC instead of VARRAY. * lambda-mat.c: Don't include varray.h. * tree-chrec.c: Same. * lambda-trans.c: Same. * tree-vectorizer.c (new_loop_vec_info, destroy_loop_vec_info): Use VEC instead of VARRAY. * tree-vectorizer.h: Idem. * tree-data-ref.c (dump_data_references, dump_data_dependence_relations, dump_dist_dir_vectors, dump_ddrs, initialize_data_dependence_relation, finalize_ddr_dependent, compute_all_dependences, find_data_references_in_loop, compute_data_dependences_for_loop, analyze_all_data_dependences, free_dependence_relation, free_dependence_relations, free_data_refs): Idem. * tree-data-ref.h (data_reference_p, subscript_p): New. (data_dependence_relation, DDR_SUBSCRIPT, DDR_NUM_SUBSCRIPTS): Use VEC instead of VARRAY. (DDR_SUBSCRIPTS_VECTOR_INIT): Removed. (find_data_references_in_loop, compute_data_dependences_for_loop, dump_ddrs, dump_dist_dir_vectors, dump_data_references, dump_data_dependence_relations, free_dependence_relations, free_data_refs): Adjust declaration. (lambda_transform_legal_p): Move declaration here... * tree-vect-analyze.c (vect_analyze_data_ref_dependences, vect_compute_data_refs_alignment, vect_verify_datarefs_alignment, vect_enhance_data_refs_alignment, vect_analyze_data_ref_accesses, vect_analyze_data_refs): Use VEC instead of VARRAY. * lambda.h (lambda_transform_legal_p): ...from here. * lambda-code.c (lambda_transform_legal_p): Use VEC instead of VARRAY. * tree-vect-transform.c (vect_update_inits_of_drs): Idem. * Makefile.in (tree-loop-linear.o, lambda-mat.o, lambda-trans.o, tree-chrec.o): Don't depend on VARRAY_H. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112437 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-loop-linear.c')
-rw-r--r--gcc/tree-loop-linear.c60
1 files changed, 24 insertions, 36 deletions
diff --git a/gcc/tree-loop-linear.c b/gcc/tree-loop-linear.c
index da790dc842f..a47981c94d0 100644
--- a/gcc/tree-loop-linear.c
+++ b/gcc/tree-loop-linear.c
@@ -41,7 +41,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "tree-data-ref.h"
#include "tree-scalar-evolution.h"
#include "tree-pass.h"
-#include "varray.h"
#include "lambda.h"
/* Linear loop transforms include any composition of interchange,
@@ -90,8 +89,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
*/
static void
-gather_interchange_stats (varray_type dependence_relations,
- varray_type datarefs,
+gather_interchange_stats (VEC (ddr_p, heap) *dependence_relations,
+ VEC (data_reference_p, heap) *datarefs,
struct loop *loop,
struct loop *first_loop,
unsigned int *dependence_steps,
@@ -99,17 +98,15 @@ gather_interchange_stats (varray_type dependence_relations,
unsigned int *access_strides)
{
unsigned int i, j;
+ struct data_dependence_relation *ddr;
+ struct data_reference *dr;
*dependence_steps = 0;
*nb_deps_not_carried_by_loop = 0;
*access_strides = 0;
- for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_relations); i++)
+ for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++)
{
- struct data_dependence_relation *ddr =
- (struct data_dependence_relation *)
- VARRAY_GENERIC_PTR (dependence_relations, i);
-
/* If we don't know anything about this dependence, or the distance
vector is NULL, or there is no dependence, then there is no reuse of
data. */
@@ -134,10 +131,9 @@ gather_interchange_stats (varray_type dependence_relations,
}
/* Compute the access strides. */
- for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
+ for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
unsigned int it;
- struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i);
tree stmt = DR_STMT (dr);
struct loop *stmt_loop = loop_containing_stmt (stmt);
struct loop *inner_loop = first_loop->inner;
@@ -171,8 +167,8 @@ gather_interchange_stats (varray_type dependence_relations,
static lambda_trans_matrix
try_interchange_loops (lambda_trans_matrix trans,
unsigned int depth,
- varray_type dependence_relations,
- varray_type datarefs,
+ VEC (ddr_p, heap) *dependence_relations,
+ VEC (data_reference_p, heap) *datarefs,
struct loop *first_loop)
{
struct loop *loop_i;
@@ -184,8 +180,7 @@ try_interchange_loops (lambda_trans_matrix trans,
/* When there is an unknown relation in the dependence_relations, we
know that it is no worth looking at this loop nest: give up. */
- ddr = (struct data_dependence_relation *)
- VARRAY_GENERIC_PTR (dependence_relations, 0);
+ ddr = VEC_index (ddr_p, dependence_relations, 0);
if (ddr == NULL || DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
return trans;
@@ -250,8 +245,8 @@ linear_transform_loops (struct loops *loops)
for (i = 1; i < loops->num; i++)
{
unsigned int depth = 0;
- varray_type datarefs;
- varray_type dependence_relations;
+ VEC (ddr_p, heap) *dependence_relations;
+ VEC (data_reference_p, heap) *datarefs;
struct loop *loop_nest = loops->parray[i];
struct loop *temp;
lambda_loopnest before, after;
@@ -292,31 +287,17 @@ linear_transform_loops (struct loops *loops)
/* Analyze data references and dependence relations using scev. */
- VARRAY_GENERIC_PTR_INIT (datarefs, 10, "datarefs");
- VARRAY_GENERIC_PTR_INIT (dependence_relations, 10,
- "dependence_relations");
-
-
- compute_data_dependences_for_loop (loop_nest, true,
- &datarefs, &dependence_relations);
+ datarefs = VEC_alloc (data_reference_p, heap, 10);
+ dependence_relations = VEC_alloc (ddr_p, heap, 10 * 10);
+ compute_data_dependences_for_loop (loop_nest, true, datarefs,
+ dependence_relations);
+
if (dump_file && (dump_flags & TDF_DETAILS))
- {
- unsigned int j;
- for (j = 0; j < VARRAY_ACTIVE_SIZE (dependence_relations); j++)
- {
- struct data_dependence_relation *ddr =
- (struct data_dependence_relation *)
- VARRAY_GENERIC_PTR (dependence_relations, j);
+ dump_ddrs (dump_file, dependence_relations);
- if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE)
- dump_data_dependence_relation (dump_file, ddr);
- }
- fprintf (dump_file, "\n\n");
- }
/* Build the transformation matrix. */
trans = lambda_trans_matrix_new (depth, depth);
lambda_matrix_id (LTM_MATRIX (trans), depth);
-
trans = try_interchange_loops (trans, depth, dependence_relations,
datarefs, loop_nest);
@@ -334,8 +315,10 @@ linear_transform_loops (struct loops *loops)
fprintf (dump_file, "Can't transform loop, transform is illegal:\n");
continue;
}
+
if (!perfect_nest_p (loop_nest))
need_perfect_nest = true;
+
before = gcc_loopnest_to_lambda_loopnest (loops,
loop_nest, &oldivs,
&invariants,
@@ -350,18 +333,23 @@ linear_transform_loops (struct loops *loops)
}
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);
+
if (dump_file)
fprintf (dump_file, "Successfully transformed loop.\n");
+
free_dependence_relations (dependence_relations);
free_data_refs (datarefs);
}
+
VEC_free (tree, heap, oldivs);
VEC_free (tree, heap, invariants);
scev_reset ();