diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-28 04:19:26 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-28 04:19:26 +0000 |
commit | 41c7a32495cd3504d8df84dda26c4c5d1de25185 (patch) | |
tree | 29bb0dc8b58695cd2522e866ebb0a5c9b775a9e4 | |
parent | 12de5dc01f0a893a14554bb32e7bea2abd154210 (diff) | |
download | gcc-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
-rw-r--r-- | gcc/ChangeLog | 37 | ||||
-rw-r--r-- | gcc/Makefile.in | 8 | ||||
-rw-r--r-- | gcc/lambda-code.c | 10 | ||||
-rw-r--r-- | gcc/lambda-mat.c | 1 | ||||
-rw-r--r-- | gcc/lambda-trans.c | 1 | ||||
-rw-r--r-- | gcc/lambda.h | 1 | ||||
-rw-r--r-- | gcc/tree-chrec.c | 1 | ||||
-rw-r--r-- | gcc/tree-data-ref.c | 260 | ||||
-rw-r--r-- | gcc/tree-data-ref.h | 42 | ||||
-rw-r--r-- | gcc/tree-loop-linear.c | 60 | ||||
-rw-r--r-- | gcc/tree-vect-analyze.c | 97 | ||||
-rw-r--r-- | gcc/tree-vect-transform.c | 10 | ||||
-rw-r--r-- | gcc/tree-vectorizer.c | 8 | ||||
-rw-r--r-- | gcc/tree-vectorizer.h | 4 |
14 files changed, 254 insertions, 286 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8a763c2fda1..b8a8a7d59fa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,40 @@ +2006-03-27 Sebastian Pop <pop@cri.ensmp.fr> + + * 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. + 2006-03-27 Maxim Kuvyrkov <mkuvyrkov@ispras.ru> * rtl.def (Copyright): Update date. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 4aa7e4d8e2c..234247ba6a3 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2046,7 +2046,7 @@ tree-browser.o : tree-browser.c tree-browser.def $(CONFIG_H) $(SYSTEM_H) \ $(TM_H) coretypes.h tree-chrec.o: tree-chrec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(GGC_H) $(TREE_H) $(REAL_H) $(SCEV_H) tree-pass.h $(PARAMS_H) \ - $(DIAGNOSTIC_H) $(VARRAY_H) $(CFGLOOP_H) $(TREE_FLOW_H) + $(DIAGNOSTIC_H) $(CFGLOOP_H) $(TREE_FLOW_H) tree-scalar-evolution.o: tree-scalar-evolution.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(REAL_H) $(RTL_H) \ $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) \ @@ -2078,7 +2078,7 @@ tree-loop-linear.o: tree-loop-linear.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(GGC_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) \ $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \ tree-pass.h $(TREE_DATA_REF_H) $(SCEV_H) $(EXPR_H) $(LAMBDA_H) \ - $(TARGET_H) tree-chrec.h $(VARRAY_H) + $(TARGET_H) tree-chrec.h tree-stdarg.o: tree-stdarg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(FUNCTION_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) tree-pass.h \ tree-stdarg.h $(TARGET_H) langhooks.h @@ -2582,9 +2582,9 @@ ifcvt.o : ifcvt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TARGET_H) $(BASIC_BLOCK_H) $(EXPR_H) output.h except.h $(TM_P_H) \ $(REAL_H) $(OPTABS_H) $(CFGLOOP_H) hard-reg-set.h timevar.h tree-pass.h lambda-mat.o : lambda-mat.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \ - $(TM_H) coretypes.h $(TREE_H) $(VARRAY_H) + $(TM_H) coretypes.h $(TREE_H) lambda-trans.o: lambda-trans.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \ - $(TM_H) coretypes.h $(TARGET_H) $(TREE_H) $(VARRAY_H) + $(TM_H) coretypes.h $(TARGET_H) $(TREE_H) lambda-code.o: lambda-code.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \ $(TM_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) \ $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \ diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c index a47f5801bae..8c8b1e5f342 100644 --- a/gcc/lambda-code.c +++ b/gcc/lambda-code.c @@ -2578,7 +2578,7 @@ perfect_nestify (struct loops *loops, bool lambda_transform_legal_p (lambda_trans_matrix trans, int nb_loops, - varray_type dependence_relations) + VEC (ddr_p, heap) *dependence_relations) { unsigned int i, j; lambda_vector distres; @@ -2589,8 +2589,7 @@ lambda_transform_legal_p (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) return true; if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know) @@ -2599,11 +2598,8 @@ lambda_transform_legal_p (lambda_trans_matrix trans, distres = lambda_vector_new (nb_loops); /* For each distance vector in the dependence graph. */ - for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_relations); i++) + for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++) { - ddr = (struct data_dependence_relation *) - VARRAY_GENERIC_PTR (dependence_relations, i); - /* Don't care about relations for which we know that there is no dependence, nor about read-read (aka. output-dependences): these data accesses can happen in any order. */ diff --git a/gcc/lambda-mat.c b/gcc/lambda-mat.c index 0485a0f0c5c..39b75e66f73 100644 --- a/gcc/lambda-mat.c +++ b/gcc/lambda-mat.c @@ -23,7 +23,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "coretypes.h" #include "tm.h" #include "ggc.h" -#include "varray.h" #include "tree.h" #include "lambda.h" diff --git a/gcc/lambda-trans.c b/gcc/lambda-trans.c index 301db32a98b..aff2f1df040 100644 --- a/gcc/lambda-trans.c +++ b/gcc/lambda-trans.c @@ -26,7 +26,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "ggc.h" #include "tree.h" #include "target.h" -#include "varray.h" #include "lambda.h" /* Allocate a new transformation matrix. */ diff --git a/gcc/lambda.h b/gcc/lambda.h index 7a43be29b59..fc5679a5763 100644 --- a/gcc/lambda.h +++ b/gcc/lambda.h @@ -143,7 +143,6 @@ lambda_loopnest lambda_loopnest_transform (lambda_loopnest, lambda_trans_matrix) struct loop; struct loops; bool perfect_nest_p (struct loop *); -bool lambda_transform_legal_p (lambda_trans_matrix, int, varray_type); void print_lambda_loopnest (FILE *, lambda_loopnest, char); #define lambda_loop_new() (lambda_loop) ggc_alloc_cleared (sizeof (struct lambda_loop_s)) diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index 8edc5b9bbec..3863e087029 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -32,7 +32,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "tree.h" #include "real.h" #include "diagnostic.h" -#include "varray.h" #include "cfgloop.h" #include "tree-flow.h" #include "tree-chrec.h" diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 8c3ee359e33..7f9dc3274a0 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -526,25 +526,26 @@ int_divides_p (int a, int b) /* Dump into FILE all the data references from DATAREFS. */ void -dump_data_references (FILE *file, - varray_type datarefs) +dump_data_references (FILE *file, VEC (data_reference_p, heap) *datarefs) { unsigned int i; - - for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) - dump_data_reference (file, VARRAY_GENERIC_PTR (datarefs, i)); + struct data_reference *dr; + + for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++) + dump_data_reference (file, dr); } -/* Dump into FILE all the dependence relations from DDR. */ +/* Dump into FILE all the dependence relations from DDRS. */ void dump_data_dependence_relations (FILE *file, - varray_type ddr) + VEC (ddr_p, heap) *ddrs) { unsigned int i; - - for (i = 0; i < VARRAY_ACTIVE_SIZE (ddr); i++) - dump_data_dependence_relation (file, VARRAY_GENERIC_PTR (ddr, i)); + struct data_dependence_relation *ddr; + + for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++) + dump_data_dependence_relation (file, ddr); } /* Dump function for a DATA_REFERENCE structure. */ @@ -790,52 +791,44 @@ dump_data_dependence_direction (FILE *file, considered nest. */ void -dump_dist_dir_vectors (FILE *file, varray_type ddrs) +dump_dist_dir_vectors (FILE *file, VEC (ddr_p, heap) *ddrs) { unsigned int i, j; + struct data_dependence_relation *ddr; + lambda_vector v; - for (i = 0; i < VARRAY_ACTIVE_SIZE (ddrs); i++) - { - struct data_dependence_relation *ddr = - (struct data_dependence_relation *) - VARRAY_GENERIC_PTR (ddrs, i); - if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE - && DDR_AFFINE_P (ddr)) - { - for (j = 0; j < DDR_NUM_DIST_VECTS (ddr); j++) - { - fprintf (file, "DISTANCE_V ("); - print_lambda_vector (file, DDR_DIST_VECT (ddr, j), - DDR_NB_LOOPS (ddr)); - fprintf (file, ")\n"); - } + for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++) + if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE && DDR_AFFINE_P (ddr)) + { + for (j = 0; VEC_iterate (lambda_vector, DDR_DIST_VECTS (ddr), j, v); j++) + { + fprintf (file, "DISTANCE_V ("); + print_lambda_vector (file, v, DDR_NB_LOOPS (ddr)); + fprintf (file, ")\n"); + } + + for (j = 0; VEC_iterate (lambda_vector, DDR_DIR_VECTS (ddr), j, v); j++) + { + fprintf (file, "DIRECTION_V ("); + print_direction_vector (file, v, DDR_NB_LOOPS (ddr)); + fprintf (file, ")\n"); + } + } - for (j = 0; j < DDR_NUM_DIR_VECTS (ddr); j++) - { - fprintf (file, "DIRECTION_V ("); - print_direction_vector (file, DDR_DIR_VECT (ddr, j), - DDR_NB_LOOPS (ddr)); - fprintf (file, ")\n"); - } - } - } fprintf (file, "\n\n"); } /* Dumps the data dependence relations DDRS in FILE. */ void -dump_ddrs (FILE *file, varray_type ddrs) +dump_ddrs (FILE *file, VEC (ddr_p, heap) *ddrs) { unsigned int i; + struct data_dependence_relation *ddr; + + for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++) + dump_data_dependence_relation (file, ddr); - for (i = 0; i < VARRAY_ACTIVE_SIZE (ddrs); i++) - { - struct data_dependence_relation *ddr = - (struct data_dependence_relation *) - VARRAY_GENERIC_PTR (ddrs, i); - dump_data_dependence_relation (file, ddr); - } fprintf (file, "\n\n"); } @@ -2135,7 +2128,7 @@ initialize_data_dependence_relation (struct data_reference *a, DDR_AFFINE_P (res) = true; DDR_ARE_DEPENDENT (res) = NULL_TREE; - DDR_SUBSCRIPTS_VECTOR_INIT (res, DR_NUM_DIMENSIONS (a)); + DDR_SUBSCRIPTS (res) = VEC_alloc (subscript_p, heap, DR_NUM_DIMENSIONS (a)); DDR_LOOP_NEST (res) = loop_nest; DDR_DIR_VECTS (res) = NULL; DDR_DIST_VECTS (res) = NULL; @@ -2149,9 +2142,9 @@ initialize_data_dependence_relation (struct data_reference *a, SUB_CONFLICTS_IN_B (subscript) = chrec_dont_know; SUB_LAST_CONFLICT (subscript) = chrec_dont_know; SUB_DISTANCE (subscript) = chrec_dont_know; - VARRAY_PUSH_GENERIC_PTR (DDR_SUBSCRIPTS (res), subscript); + VEC_safe_push (subscript_p, heap, DDR_SUBSCRIPTS (res), subscript); } - + return res; } @@ -2170,7 +2163,7 @@ finalize_ddr_dependent (struct data_dependence_relation *ddr, } DDR_ARE_DEPENDENT (ddr) = chrec; - varray_clear (DDR_SUBSCRIPTS (ddr)); + VEC_free (subscript_p, heap, DDR_SUBSCRIPTS (ddr)); } /* The dependence relation DDR cannot be represented by a distance @@ -3776,17 +3769,18 @@ subscript_dependence_tester_1 (struct data_dependence_relation *ddr, { unsigned int i; tree last_conflicts; + struct subscript *subscript; - for (i = 0; i < DDR_NUM_SUBSCRIPTS (ddr); i++) + for (i = 0; VEC_iterate (subscript_p, DDR_SUBSCRIPTS (ddr), i, subscript); + i++) { tree overlaps_a, overlaps_b; - struct subscript *subscript = DDR_SUBSCRIPT (ddr, i); - + analyze_overlapping_iterations (DR_ACCESS_FN (dra, i), DR_ACCESS_FN (drb, i), &overlaps_a, &overlaps_b, &last_conflicts); - + if (chrec_contains_undetermined (overlaps_a) || chrec_contains_undetermined (overlaps_b)) { @@ -3794,7 +3788,7 @@ subscript_dependence_tester_1 (struct data_dependence_relation *ddr, dependence_stats.num_dependence_undetermined++; return false; } - + else if (overlaps_a == chrec_known || overlaps_b == chrec_known) { @@ -3802,7 +3796,7 @@ subscript_dependence_tester_1 (struct data_dependence_relation *ddr, dependence_stats.num_dependence_independent++; return false; } - + else { SUB_CONFLICTS_IN_A (subscript) = overlaps_a; @@ -3916,11 +3910,11 @@ static void compute_self_dependence (struct data_dependence_relation *ddr) { unsigned int i; + struct subscript *subscript; - for (i = 0; i < DDR_NUM_SUBSCRIPTS (ddr); i++) + for (i = 0; VEC_iterate (subscript_p, DDR_SUBSCRIPTS (ddr), i, subscript); + i++) { - struct subscript *subscript = DDR_SUBSCRIPT (ddr, i); - /* The accessed index overlaps for each iteration. */ SUB_CONFLICTS_IN_A (subscript) = integer_zero_node; SUB_CONFLICTS_IN_B (subscript) = integer_zero_node; @@ -3934,53 +3928,35 @@ compute_self_dependence (struct data_dependence_relation *ddr) /* Compute in DEPENDENCE_RELATIONS the data dependence graph for all the data references in DATAREFS, in the LOOP_NEST. When - COMPUTE_SELF_AND_READ_READ_DEPENDENCES is FALSE, don't compute - read-read and self relations. */ + COMPUTE_SELF_AND_RR is FALSE, don't compute read-read and self + relations. */ static void -compute_all_dependences (varray_type datarefs, - VEC(ddr_p,heap) **dependence_relations, +compute_all_dependences (VEC (data_reference_p, heap) *datarefs, + VEC (ddr_p, heap) *dependence_relations, VEC (loop_p, heap) *loop_nest, - bool compute_self_and_read_read_dependences) + bool compute_self_and_rr) { - unsigned int i, j, N = VARRAY_ACTIVE_SIZE (datarefs); + struct data_dependence_relation *ddr; + struct data_reference *a, *b; + unsigned int i, j; - /* Note that we specifically skip i == j because it's a self dependence, and - use compute_self_dependence below. */ + for (i = 0; VEC_iterate (data_reference_p, datarefs, i, a); i++) + for (j = i + 1; VEC_iterate (data_reference_p, datarefs, j, b); j++) + if (!DR_IS_READ (a) || !DR_IS_READ (b) || compute_self_and_rr) + { + ddr = initialize_data_dependence_relation (a, b, loop_nest); + VEC_safe_push (ddr_p, heap, dependence_relations, ddr); + compute_affine_dependence (ddr); + } - for (i = 0; i < N; i++) - for (j = i + 1; j < N; j++) + if (compute_self_and_rr) + for (i = 0; VEC_iterate (data_reference_p, datarefs, i, a); i++) { - struct data_reference *a, *b; - struct data_dependence_relation *ddr; - - a = VARRAY_GENERIC_PTR (datarefs, i); - b = VARRAY_GENERIC_PTR (datarefs, j); - - if (DR_IS_READ (a) && DR_IS_READ (b) - && !compute_self_and_read_read_dependences) - continue; - - ddr = initialize_data_dependence_relation (a, b, loop_nest); - VEC_safe_push (ddr_p, heap, *dependence_relations, ddr); - compute_affine_dependence (ddr); + ddr = initialize_data_dependence_relation (a, a, loop_nest); + VEC_safe_push (ddr_p, heap, dependence_relations, ddr); + compute_self_dependence (ddr); } - - if (!compute_self_and_read_read_dependences) - return; - - /* Compute self dependence relation of each dataref to itself. */ - for (i = 0; i < N; i++) - { - struct data_reference *a, *b; - struct data_dependence_relation *ddr; - - a = VARRAY_GENERIC_PTR (datarefs, i); - b = VARRAY_GENERIC_PTR (datarefs, i); - ddr = initialize_data_dependence_relation (a, b, loop_nest); - VEC_safe_push (ddr_p, heap, *dependence_relations, ddr); - compute_self_dependence (ddr); - } } /* Search the data references in LOOP, and record the information into @@ -3991,7 +3967,8 @@ compute_all_dependences (varray_type datarefs, arithmetic as if they were array accesses, etc. */ tree -find_data_references_in_loop (struct loop *loop, varray_type *datarefs) +find_data_references_in_loop (struct loop *loop, + VEC (data_reference_p, heap) *datarefs) { basic_block bb, *bbs; unsigned int i; @@ -4035,7 +4012,7 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs) dr = create_data_ref (opnd0, stmt, false); if (dr) { - VARRAY_PUSH_GENERIC_PTR (*datarefs, dr); + VEC_safe_push (data_reference_p, heap, datarefs, dr); one_inserted = true; } } @@ -4047,7 +4024,7 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs) dr = create_data_ref (opnd1, stmt, true); if (dr) { - VARRAY_PUSH_GENERIC_PTR (*datarefs, dr); + VEC_safe_push (data_reference_p, heap, datarefs, dr); one_inserted = true; } } @@ -4072,7 +4049,7 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs) dr = create_data_ref (TREE_VALUE (args), stmt, true); if (dr) { - VARRAY_PUSH_GENERIC_PTR (*datarefs, dr); + VEC_safe_push (data_reference_p, heap, datarefs, dr); one_inserted = true; } } @@ -4103,7 +4080,7 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs) DR_OFFSET_MISALIGNMENT (res) = NULL_TREE; DR_MEMTAG (res) = NULL_TREE; DR_PTR_INFO (res) = NULL; - VARRAY_PUSH_GENERIC_PTR (*datarefs, res); + VEC_safe_push (data_reference_p, heap, datarefs, res); free (bbs); return chrec_dont_know; @@ -4164,20 +4141,17 @@ find_loop_nest (struct loop *loop, VEC (loop_p, heap) *loop_nest) } /* Given a loop nest LOOP, the following vectors are returned: - *DATAREFS is initialized to all the array elements contained in this loop, - *DEPENDENCE_RELATIONS contains the relations between the data references. + DATAREFS is initialized to all the array elements contained in this loop, + DEPENDENCE_RELATIONS contains the relations between the data references. Compute read-read and self relations if COMPUTE_SELF_AND_READ_READ_DEPENDENCES is TRUE. */ void compute_data_dependences_for_loop (struct loop *loop, bool compute_self_and_read_read_dependences, - varray_type *datarefs, - varray_type *dependence_relations) + VEC (data_reference_p, heap) *datarefs, + VEC (ddr_p, heap) *dependence_relations) { - unsigned int i; - VEC(ddr_p,heap) *allrelations; - struct data_dependence_relation *ddr; struct loop *loop_nest = loop; VEC (loop_p, heap) *vloops = VEC_alloc (loop_p, heap, 3); @@ -4195,20 +4169,11 @@ compute_data_dependences_for_loop (struct loop *loop, /* Insert a single relation into dependence_relations: chrec_dont_know. */ ddr = initialize_data_dependence_relation (NULL, NULL, vloops); - VARRAY_PUSH_GENERIC_PTR (*dependence_relations, ddr); + VEC_safe_push (ddr_p, heap, dependence_relations, ddr); } else - { - allrelations = NULL; - compute_all_dependences (*datarefs, &allrelations, vloops, - compute_self_and_read_read_dependences); - - - /* FIXME: We copy the contents of allrelations back to a VARRAY - because the vectorizer has not yet been converted to use VECs. */ - for (i = 0; VEC_iterate (ddr_p, allrelations, i, ddr); i++) - VARRAY_PUSH_GENERIC_PTR (*dependence_relations, ddr); - } + compute_all_dependences (datarefs, dependence_relations, vloops, + compute_self_and_read_read_dependences); if (dump_file && (dump_flags & TDF_STATS)) { @@ -4285,18 +4250,15 @@ static void analyze_all_data_dependences (struct loops *loops) { unsigned int i; - varray_type datarefs; - varray_type dependence_relations; int nb_data_refs = 10; - - VARRAY_GENERIC_PTR_INIT (datarefs, nb_data_refs, "datarefs"); - VARRAY_GENERIC_PTR_INIT (dependence_relations, - nb_data_refs * nb_data_refs, - "dependence_relations"); + VEC (data_reference_p, heap) *datarefs = + VEC_alloc (data_reference_p, heap, nb_data_refs); + VEC (ddr_p, heap) *dependence_relations = + VEC_alloc (ddr_p, heap, nb_data_refs * nb_data_refs); /* Compute DDs on the whole function. */ compute_data_dependences_for_loop (loops->parray[0], false, - &datarefs, &dependence_relations); + datarefs, dependence_relations); if (dump_file) { @@ -4312,12 +4274,10 @@ analyze_all_data_dependences (struct loops *loops) unsigned nb_bot_relations = 0; unsigned nb_basename_differ = 0; unsigned nb_chrec_relations = 0; + struct data_dependence_relation *ddr; - 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; - ddr = VARRAY_GENERIC_PTR (dependence_relations, i); - if (chrec_contains_undetermined (DDR_ARE_DEPENDENT (ddr))) nb_top_relations++; @@ -4358,7 +4318,8 @@ free_dependence_relation (struct data_dependence_relation *ddr) return; if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE && DDR_SUBSCRIPTS (ddr)) - varray_clear (DDR_SUBSCRIPTS (ddr)); + VEC_free (subscript_p, heap, DDR_SUBSCRIPTS (ddr)); + free (ddr); } @@ -4366,37 +4327,34 @@ free_dependence_relation (struct data_dependence_relation *ddr) DEPENDENCE_RELATIONS. */ void -free_dependence_relations (varray_type dependence_relations) +free_dependence_relations (VEC (ddr_p, heap) *dependence_relations) { unsigned int i; - if (dependence_relations == NULL) - return; + struct data_dependence_relation *ddr; - for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_relations); i++) - free_dependence_relation (VARRAY_GENERIC_PTR (dependence_relations, i)); - varray_clear (dependence_relations); + for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++) + free_dependence_relation (ddr); + + VEC_free (ddr_p, heap, dependence_relations); } /* Free the memory used by the data references from DATAREFS. */ void -free_data_refs (varray_type datarefs) +free_data_refs (VEC (data_reference_p, heap) *datarefs) { unsigned int i; - - if (datarefs == NULL) - return; + struct data_reference *dr; - for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) + for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++) { - struct data_reference *dr = (struct data_reference *) - VARRAY_GENERIC_PTR (datarefs, i); - if (dr) - { - DR_FREE_ACCESS_FNS (dr); - free (dr); - } + if (DR_TYPE(dr) == ARRAY_REF_TYPE) + VEC_free (tree, heap, (dr)->object_info.access_fns); + else + VEC_free (tree, heap, (dr)->first_location.access_fns); + + free (dr); } - varray_clear (datarefs); + VEC_free (data_reference_p, heap, datarefs); } diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h index 1f996f43097..c5976f982dc 100644 --- a/gcc/tree-data-ref.h +++ b/gcc/tree-data-ref.h @@ -107,6 +107,10 @@ struct data_reference enum data_ref_type type; }; +typedef struct data_reference *data_reference_p; +DEF_VEC_P(data_reference_p); +DEF_VEC_ALLOC_P (data_reference_p, heap); + #define DR_STMT(DR) (DR)->stmt #define DR_REF(DR) (DR)->ref #define DR_BASE_OBJECT(DR) (DR)->object_info.base_object @@ -181,6 +185,10 @@ struct subscript tree distance; }; +typedef struct subscript *subscript_p; +DEF_VEC_P(subscript_p); +DEF_VEC_ALLOC_P (subscript_p, heap); + #define SUB_CONFLICTS_IN_A(SUB) SUB->conflicting_iterations_in_a #define SUB_CONFLICTS_IN_B(SUB) SUB->conflicting_iterations_in_b #define SUB_LAST_CONFLICT(SUB) SUB->last_conflict @@ -219,16 +227,16 @@ struct data_dependence_relation /* For each subscript in the dependence test, there is an element in this array. This is the attribute that labels the edge A->B of the data_dependence_relation. */ - varray_type subscripts; + VEC (subscript_p, heap) *subscripts; /* The analyzed loop nest. */ VEC (loop_p, heap) *loop_nest; /* The classic direction vector. */ - VEC(lambda_vector,heap) *dir_vects; + VEC (lambda_vector, heap) *dir_vects; /* The classic distance vector. */ - VEC(lambda_vector,heap) *dist_vects; + VEC (lambda_vector, heap) *dist_vects; }; typedef struct data_dependence_relation *ddr_p; @@ -240,10 +248,8 @@ DEF_VEC_ALLOC_P(ddr_p,heap); #define DDR_AFFINE_P(DDR) DDR->affine_p #define DDR_ARE_DEPENDENT(DDR) DDR->are_dependent #define DDR_SUBSCRIPTS(DDR) DDR->subscripts -#define DDR_SUBSCRIPTS_VECTOR_INIT(DDR, N) \ - VARRAY_GENERIC_PTR_INIT (DDR_SUBSCRIPTS (DDR), N, "subscripts_vector"); -#define DDR_SUBSCRIPT(DDR, I) VARRAY_GENERIC_PTR (DDR_SUBSCRIPTS (DDR), I) -#define DDR_NUM_SUBSCRIPTS(DDR) VARRAY_ACTIVE_SIZE (DDR_SUBSCRIPTS (DDR)) +#define DDR_SUBSCRIPT(DDR, I) VEC_index (subscript_p, DDR_SUBSCRIPTS (DDR), I) +#define DDR_NUM_SUBSCRIPTS(DDR) VEC_length (subscript_p, DDR_SUBSCRIPTS (DDR)) #define DDR_LOOP_NEST(DDR) DDR->loop_nest /* The size of the direction/distance vectors: the number of loops in @@ -263,29 +269,32 @@ DEF_VEC_ALLOC_P(ddr_p,heap); -extern tree find_data_references_in_loop (struct loop *, varray_type *); +extern tree find_data_references_in_loop (struct loop *, + VEC (data_reference_p, heap) *); extern void compute_data_dependences_for_loop (struct loop *, bool, - varray_type *, varray_type *); + VEC (data_reference_p, heap) *, + VEC (ddr_p, heap) *); extern void print_direction_vector (FILE *, lambda_vector, int); extern void print_dir_vectors (FILE *, VEC (lambda_vector, heap) *, int); extern void print_dist_vectors (FILE *, VEC (lambda_vector, heap) *, int); extern void dump_subscript (FILE *, struct subscript *); -extern void dump_ddrs (FILE *, varray_type); -extern void dump_dist_dir_vectors (FILE *, varray_type); +extern void dump_ddrs (FILE *, VEC (ddr_p, heap) *); +extern void dump_dist_dir_vectors (FILE *, VEC (ddr_p, heap) *); extern void dump_data_reference (FILE *, struct data_reference *); -extern void dump_data_references (FILE *, varray_type); +extern void dump_data_references (FILE *, VEC (data_reference_p, heap) *); extern void debug_data_dependence_relation (struct data_dependence_relation *); extern void dump_data_dependence_relation (FILE *, struct data_dependence_relation *); -extern void dump_data_dependence_relations (FILE *, varray_type); +extern void dump_data_dependence_relations (FILE *, VEC (ddr_p, heap) *); extern void dump_data_dependence_direction (FILE *, enum data_dependence_direction); extern void free_dependence_relation (struct data_dependence_relation *); -extern void free_dependence_relations (varray_type); -extern void free_data_refs (varray_type); +extern void free_dependence_relations (VEC (ddr_p, heap) *); +extern void free_data_refs (VEC (data_reference_p, heap) *); extern struct data_reference *analyze_array (tree, tree, bool); extern void estimate_iters_using_array (tree, tree); + /* Return the index of the variable VAR in the LOOP_NEST array. */ static inline int @@ -302,6 +311,7 @@ index_in_loop_nest (int var, VEC (loop_p, heap) *loop_nest) return var_index; } - +/* In lambda-code.c */ +bool lambda_transform_legal_p (lambda_trans_matrix, int, VEC (ddr_p, heap) *); #endif /* GCC_TREE_DATA_REF_H */ 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 (); diff --git a/gcc/tree-vect-analyze.c b/gcc/tree-vect-analyze.c index 8afaa1b3719..f6319428552 100644 --- a/gcc/tree-vect-analyze.c +++ b/gcc/tree-vect-analyze.c @@ -679,18 +679,15 @@ static bool vect_analyze_data_ref_dependences (loop_vec_info loop_vinfo) { unsigned int i; - varray_type ddrs = LOOP_VINFO_DDRS (loop_vinfo); + VEC (ddr_p, heap) *ddrs = LOOP_VINFO_DDRS (loop_vinfo); + struct data_dependence_relation *ddr; if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "=== vect_analyze_dependences ==="); - for (i = 0; i < VARRAY_ACTIVE_SIZE (ddrs); i++) - { - struct data_dependence_relation *ddr = VARRAY_GENERIC_PTR (ddrs, i); - - if (vect_analyze_data_ref_dependence (ddr, loop_vinfo)) - return false; - } + for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++) + if (vect_analyze_data_ref_dependence (ddr, loop_vinfo)) + return false; return true; } @@ -812,15 +809,13 @@ vect_compute_data_ref_alignment (struct data_reference *dr) static bool vect_compute_data_refs_alignment (loop_vec_info loop_vinfo) { - varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); + VEC (data_reference_p, heap) *datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); + struct data_reference *dr; unsigned int i; - for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) - { - struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i); - if (!vect_compute_data_ref_alignment (dr)) - return false; - } + for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++) + if (!vect_compute_data_ref_alignment (dr)) + return false; return true; } @@ -884,13 +879,13 @@ vect_update_misalignment_for_peel (struct data_reference *dr, static bool vect_verify_datarefs_alignment (loop_vec_info loop_vinfo) { - varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); + VEC (data_reference_p, heap) *datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); + struct data_reference *dr; enum dr_alignment_support supportable_dr_alignment; unsigned int i; - for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) + for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++) { - struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i); supportable_dr_alignment = vect_supportable_dr_alignment (dr); if (!supportable_dr_alignment) { @@ -1007,7 +1002,7 @@ vect_verify_datarefs_alignment (loop_vec_info loop_vinfo) static bool vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) { - varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); + VEC (data_reference_p, heap) *datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); enum dr_alignment_support supportable_dr_alignment; struct data_reference *dr0 = NULL; struct data_reference *dr; @@ -1055,16 +1050,13 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) TODO: Use a cost model. */ - for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) - { - dr = VARRAY_GENERIC_PTR (datarefs, i); - if (!DR_IS_READ (dr) && !aligned_access_p (dr)) - { - dr0 = dr; - do_peeling = true; - break; - } - } + for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++) + if (!DR_IS_READ (dr) && !aligned_access_p (dr)) + { + dr0 = dr; + do_peeling = true; + break; + } /* Often peeling for alignment will require peeling for loop-bound, which in turn requires that we know how to adjust the loop ivs after the loop. */ @@ -1088,13 +1080,13 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) } /* Ensure that all data refs can be vectorized after the peel. */ - for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) + for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++) { int save_misalignment; - dr = VARRAY_GENERIC_PTR (datarefs, i); if (dr == dr0) continue; + save_misalignment = DR_MISALIGNMENT (dr); vect_update_misalignment_for_peel (dr, dr0, npeel); supportable_dr_alignment = vect_supportable_dr_alignment (dr); @@ -1116,13 +1108,9 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) by the peeling factor times the element size of DR_i (MOD the vectorization factor times the size). Otherwise, the misalignment of DR_i must be set to unknown. */ - for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) - { - dr = VARRAY_GENERIC_PTR (datarefs, i); - if (dr == dr0) - continue; + for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++) + if (dr != dr0) vect_update_misalignment_for_peel (dr, dr0, npeel); - } LOOP_VINFO_UNALIGNED_DR (loop_vinfo) = dr0; LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo) = DR_MISALIGNMENT (dr0); @@ -1154,10 +1142,8 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) if (do_versioning) { - for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) + for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++) { - dr = VARRAY_GENERIC_PTR (datarefs, i); - if (aligned_access_p (dr)) continue; @@ -1303,21 +1289,19 @@ static bool vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo) { unsigned int i; - varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); + VEC (data_reference_p, heap) *datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); + struct data_reference *dr; if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "=== vect_analyze_data_ref_accesses ==="); - for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) - { - struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i); - if (!vect_analyze_data_ref_access (dr)) - { - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS)) - fprintf (vect_dump, "not vectorized: complicated access pattern."); - return false; - } - } + for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++) + if (!vect_analyze_data_ref_access (dr)) + { + if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS)) + fprintf (vect_dump, "not vectorized: complicated access pattern."); + return false; + } return true; } @@ -1342,22 +1326,23 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo) { struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); unsigned int i; - varray_type datarefs; + VEC (data_reference_p, heap) *datarefs; + struct data_reference *dr; tree scalar_type; if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "=== vect_analyze_data_refs ==="); compute_data_dependences_for_loop (loop, false, - &(LOOP_VINFO_DATAREFS (loop_vinfo)), - &(LOOP_VINFO_DDRS (loop_vinfo))); + LOOP_VINFO_DATAREFS (loop_vinfo), + LOOP_VINFO_DDRS (loop_vinfo)); /* Go through the data-refs, check that the analysis succeeded. Update pointer from stmt_vec_info struct to DR and vectype. */ datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); - for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) + + for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++) { - struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i); tree stmt; stmt_vec_info stmt_info; diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c index 2d533e67a9a..1d23f14d1ff 100644 --- a/gcc/tree-vect-transform.c +++ b/gcc/tree-vect-transform.c @@ -2769,16 +2769,14 @@ static void vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters) { unsigned int i; - varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); + VEC (data_reference_p, heap) *datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); + struct data_reference *dr; if (vect_dump && (dump_flags & TDF_DETAILS)) fprintf (vect_dump, "=== vect_update_inits_of_dr ==="); - for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) - { - struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i); - vect_update_init_of_dr (dr, niters); - } + for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++) + vect_update_init_of_dr (dr, niters); } diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index a07af12b6a1..b6538a4b46d 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -1420,8 +1420,8 @@ new_loop_vec_info (struct loop *loop) LOOP_VINFO_VECTORIZABLE_P (res) = 0; LOOP_PEELING_FOR_ALIGNMENT (res) = 0; LOOP_VINFO_VECT_FACTOR (res) = 0; - VARRAY_GENERIC_PTR_INIT (LOOP_VINFO_DATAREFS (res), 20, "loop_datarefs"); - VARRAY_GENERIC_PTR_INIT (LOOP_VINFO_DDRS (res), 20, "loop_ddrs"); + LOOP_VINFO_DATAREFS (res) = VEC_alloc (data_reference_p, heap, 10); + LOOP_VINFO_DDRS (res) = VEC_alloc (ddr_p, heap, 10 * 10); LOOP_VINFO_UNALIGNED_DR (res) = NULL; LOOP_VINFO_MAY_MISALIGN_STMTS (res) = VEC_alloc (tree, heap, PARAM_VALUE (PARAM_VECT_MAX_VERSION_CHECKS)); @@ -1483,8 +1483,8 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo) } free (LOOP_VINFO_BBS (loop_vinfo)); - varray_clear (LOOP_VINFO_DATAREFS (loop_vinfo)); - varray_clear (LOOP_VINFO_DDRS (loop_vinfo)); + free_data_refs (LOOP_VINFO_DATAREFS (loop_vinfo)); + free_dependence_relations (LOOP_VINFO_DDRS (loop_vinfo)); VEC_free (tree, heap, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo)); free (loop_vinfo); diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 405289cba9d..3b7ca1b911a 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -122,10 +122,10 @@ typedef struct _loop_vec_info { int ptr_mask; /* All data references in the loop. */ - varray_type datarefs; + VEC (data_reference_p, heap) *datarefs; /* All data dependences in the loop. */ - varray_type ddrs; + VEC (ddr_p, heap) *ddrs; /* Statements in the loop that have data references that are candidates for a runtime (loop versioning) misalignment check. */ |