Commit ebf78a47 by Sebastian Pop Committed by Sebastian Pop

tree-loop-linear.c: Don't include varray.h.

	* 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.

From-SVN: r112437
parent 5d73a409
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> 2006-03-27 Maxim Kuvyrkov <mkuvyrkov@ispras.ru>
* rtl.def (Copyright): Update date. * rtl.def (Copyright): Update date.
......
...@@ -2046,7 +2046,7 @@ tree-browser.o : tree-browser.c tree-browser.def $(CONFIG_H) $(SYSTEM_H) \ ...@@ -2046,7 +2046,7 @@ tree-browser.o : tree-browser.c tree-browser.def $(CONFIG_H) $(SYSTEM_H) \
$(TM_H) coretypes.h $(TM_H) coretypes.h
tree-chrec.o: tree-chrec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_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) \ $(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) \ tree-scalar-evolution.o: tree-scalar-evolution.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(REAL_H) $(RTL_H) \ coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(REAL_H) $(RTL_H) \
$(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_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 \ ...@@ -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) \ $(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) \ $(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) \ 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-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_H) $(FUNCTION_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) tree-pass.h \
tree-stdarg.h $(TARGET_H) langhooks.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) \ ...@@ -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) \ $(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 $(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) \ 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) \ 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) \ 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) \ $(TM_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \ $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
......
...@@ -2578,7 +2578,7 @@ perfect_nestify (struct loops *loops, ...@@ -2578,7 +2578,7 @@ perfect_nestify (struct loops *loops,
bool bool
lambda_transform_legal_p (lambda_trans_matrix trans, lambda_transform_legal_p (lambda_trans_matrix trans,
int nb_loops, int nb_loops,
varray_type dependence_relations) VEC (ddr_p, heap) *dependence_relations)
{ {
unsigned int i, j; unsigned int i, j;
lambda_vector distres; lambda_vector distres;
...@@ -2589,8 +2589,7 @@ lambda_transform_legal_p (lambda_trans_matrix trans, ...@@ -2589,8 +2589,7 @@ lambda_transform_legal_p (lambda_trans_matrix trans,
/* When there is an unknown relation in the dependence_relations, we /* When there is an unknown relation in the dependence_relations, we
know that it is no worth looking at this loop nest: give up. */ know that it is no worth looking at this loop nest: give up. */
ddr = (struct data_dependence_relation *) ddr = VEC_index (ddr_p, dependence_relations, 0);
VARRAY_GENERIC_PTR (dependence_relations, 0);
if (ddr == NULL) if (ddr == NULL)
return true; return true;
if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know) if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
...@@ -2599,11 +2598,8 @@ lambda_transform_legal_p (lambda_trans_matrix trans, ...@@ -2599,11 +2598,8 @@ lambda_transform_legal_p (lambda_trans_matrix trans,
distres = lambda_vector_new (nb_loops); distres = lambda_vector_new (nb_loops);
/* For each distance vector in the dependence graph. */ /* 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 /* Don't care about relations for which we know that there is no
dependence, nor about read-read (aka. output-dependences): dependence, nor about read-read (aka. output-dependences):
these data accesses can happen in any order. */ these data accesses can happen in any order. */
......
...@@ -23,7 +23,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -23,7 +23,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "coretypes.h" #include "coretypes.h"
#include "tm.h" #include "tm.h"
#include "ggc.h" #include "ggc.h"
#include "varray.h"
#include "tree.h" #include "tree.h"
#include "lambda.h" #include "lambda.h"
......
...@@ -26,7 +26,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -26,7 +26,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "ggc.h" #include "ggc.h"
#include "tree.h" #include "tree.h"
#include "target.h" #include "target.h"
#include "varray.h"
#include "lambda.h" #include "lambda.h"
/* Allocate a new transformation matrix. */ /* Allocate a new transformation matrix. */
......
...@@ -143,7 +143,6 @@ lambda_loopnest lambda_loopnest_transform (lambda_loopnest, lambda_trans_matrix) ...@@ -143,7 +143,6 @@ lambda_loopnest lambda_loopnest_transform (lambda_loopnest, lambda_trans_matrix)
struct loop; struct loop;
struct loops; struct loops;
bool perfect_nest_p (struct loop *); 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); void print_lambda_loopnest (FILE *, lambda_loopnest, char);
#define lambda_loop_new() (lambda_loop) ggc_alloc_cleared (sizeof (struct lambda_loop_s)) #define lambda_loop_new() (lambda_loop) ggc_alloc_cleared (sizeof (struct lambda_loop_s))
......
...@@ -32,7 +32,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -32,7 +32,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "tree.h" #include "tree.h"
#include "real.h" #include "real.h"
#include "diagnostic.h" #include "diagnostic.h"
#include "varray.h"
#include "cfgloop.h" #include "cfgloop.h"
#include "tree-flow.h" #include "tree-flow.h"
#include "tree-chrec.h" #include "tree-chrec.h"
......
...@@ -526,25 +526,26 @@ int_divides_p (int a, int b) ...@@ -526,25 +526,26 @@ int_divides_p (int a, int b)
/* Dump into FILE all the data references from DATAREFS. */ /* Dump into FILE all the data references from DATAREFS. */
void void
dump_data_references (FILE *file, dump_data_references (FILE *file, VEC (data_reference_p, heap) *datarefs)
varray_type datarefs)
{ {
unsigned int i; unsigned int i;
struct data_reference *dr;
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
dump_data_reference (file, VARRAY_GENERIC_PTR (datarefs, i)); 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 void
dump_data_dependence_relations (FILE *file, dump_data_dependence_relations (FILE *file,
varray_type ddr) VEC (ddr_p, heap) *ddrs)
{ {
unsigned int i; unsigned int i;
struct data_dependence_relation *ddr;
for (i = 0; i < VARRAY_ACTIVE_SIZE (ddr); i++)
dump_data_dependence_relation (file, VARRAY_GENERIC_PTR (ddr, i)); for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++)
dump_data_dependence_relation (file, ddr);
} }
/* Dump function for a DATA_REFERENCE structure. */ /* Dump function for a DATA_REFERENCE structure. */
...@@ -790,52 +791,44 @@ dump_data_dependence_direction (FILE *file, ...@@ -790,52 +791,44 @@ dump_data_dependence_direction (FILE *file,
considered nest. */ considered nest. */
void 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; unsigned int i, j;
struct data_dependence_relation *ddr;
lambda_vector v;
for (i = 0; i < VARRAY_ACTIVE_SIZE (ddrs); i++) for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++)
{ if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE && DDR_AFFINE_P (ddr))
struct data_dependence_relation *ddr = {
(struct data_dependence_relation *) for (j = 0; VEC_iterate (lambda_vector, DDR_DIST_VECTS (ddr), j, v); j++)
VARRAY_GENERIC_PTR (ddrs, i); {
if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE fprintf (file, "DISTANCE_V (");
&& DDR_AFFINE_P (ddr)) print_lambda_vector (file, v, DDR_NB_LOOPS (ddr));
{ fprintf (file, ")\n");
for (j = 0; j < DDR_NUM_DIST_VECTS (ddr); j++) }
{
fprintf (file, "DISTANCE_V ("); for (j = 0; VEC_iterate (lambda_vector, DDR_DIR_VECTS (ddr), j, v); j++)
print_lambda_vector (file, DDR_DIST_VECT (ddr, j), {
DDR_NB_LOOPS (ddr)); fprintf (file, "DIRECTION_V (");
fprintf (file, ")\n"); 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"); fprintf (file, "\n\n");
} }
/* Dumps the data dependence relations DDRS in FILE. */ /* Dumps the data dependence relations DDRS in FILE. */
void void
dump_ddrs (FILE *file, varray_type ddrs) dump_ddrs (FILE *file, VEC (ddr_p, heap) *ddrs)
{ {
unsigned int i; 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"); fprintf (file, "\n\n");
} }
...@@ -2135,7 +2128,7 @@ initialize_data_dependence_relation (struct data_reference *a, ...@@ -2135,7 +2128,7 @@ initialize_data_dependence_relation (struct data_reference *a,
DDR_AFFINE_P (res) = true; DDR_AFFINE_P (res) = true;
DDR_ARE_DEPENDENT (res) = NULL_TREE; 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_LOOP_NEST (res) = loop_nest;
DDR_DIR_VECTS (res) = NULL; DDR_DIR_VECTS (res) = NULL;
DDR_DIST_VECTS (res) = NULL; DDR_DIST_VECTS (res) = NULL;
...@@ -2149,9 +2142,9 @@ initialize_data_dependence_relation (struct data_reference *a, ...@@ -2149,9 +2142,9 @@ initialize_data_dependence_relation (struct data_reference *a,
SUB_CONFLICTS_IN_B (subscript) = chrec_dont_know; SUB_CONFLICTS_IN_B (subscript) = chrec_dont_know;
SUB_LAST_CONFLICT (subscript) = chrec_dont_know; SUB_LAST_CONFLICT (subscript) = chrec_dont_know;
SUB_DISTANCE (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; return res;
} }
...@@ -2170,7 +2163,7 @@ finalize_ddr_dependent (struct data_dependence_relation *ddr, ...@@ -2170,7 +2163,7 @@ finalize_ddr_dependent (struct data_dependence_relation *ddr,
} }
DDR_ARE_DEPENDENT (ddr) = chrec; 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 /* The dependence relation DDR cannot be represented by a distance
...@@ -3776,17 +3769,18 @@ subscript_dependence_tester_1 (struct data_dependence_relation *ddr, ...@@ -3776,17 +3769,18 @@ subscript_dependence_tester_1 (struct data_dependence_relation *ddr,
{ {
unsigned int i; unsigned int i;
tree last_conflicts; 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; tree overlaps_a, overlaps_b;
struct subscript *subscript = DDR_SUBSCRIPT (ddr, i);
analyze_overlapping_iterations (DR_ACCESS_FN (dra, i), analyze_overlapping_iterations (DR_ACCESS_FN (dra, i),
DR_ACCESS_FN (drb, i), DR_ACCESS_FN (drb, i),
&overlaps_a, &overlaps_b, &overlaps_a, &overlaps_b,
&last_conflicts); &last_conflicts);
if (chrec_contains_undetermined (overlaps_a) if (chrec_contains_undetermined (overlaps_a)
|| chrec_contains_undetermined (overlaps_b)) || chrec_contains_undetermined (overlaps_b))
{ {
...@@ -3794,7 +3788,7 @@ subscript_dependence_tester_1 (struct data_dependence_relation *ddr, ...@@ -3794,7 +3788,7 @@ subscript_dependence_tester_1 (struct data_dependence_relation *ddr,
dependence_stats.num_dependence_undetermined++; dependence_stats.num_dependence_undetermined++;
return false; return false;
} }
else if (overlaps_a == chrec_known else if (overlaps_a == chrec_known
|| overlaps_b == chrec_known) || overlaps_b == chrec_known)
{ {
...@@ -3802,7 +3796,7 @@ subscript_dependence_tester_1 (struct data_dependence_relation *ddr, ...@@ -3802,7 +3796,7 @@ subscript_dependence_tester_1 (struct data_dependence_relation *ddr,
dependence_stats.num_dependence_independent++; dependence_stats.num_dependence_independent++;
return false; return false;
} }
else else
{ {
SUB_CONFLICTS_IN_A (subscript) = overlaps_a; SUB_CONFLICTS_IN_A (subscript) = overlaps_a;
...@@ -3916,11 +3910,11 @@ static void ...@@ -3916,11 +3910,11 @@ static void
compute_self_dependence (struct data_dependence_relation *ddr) compute_self_dependence (struct data_dependence_relation *ddr)
{ {
unsigned int i; 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. */ /* The accessed index overlaps for each iteration. */
SUB_CONFLICTS_IN_A (subscript) = integer_zero_node; SUB_CONFLICTS_IN_A (subscript) = integer_zero_node;
SUB_CONFLICTS_IN_B (subscript) = integer_zero_node; SUB_CONFLICTS_IN_B (subscript) = integer_zero_node;
...@@ -3934,53 +3928,35 @@ compute_self_dependence (struct data_dependence_relation *ddr) ...@@ -3934,53 +3928,35 @@ compute_self_dependence (struct data_dependence_relation *ddr)
/* Compute in DEPENDENCE_RELATIONS the data dependence graph for all /* Compute in DEPENDENCE_RELATIONS the data dependence graph for all
the data references in DATAREFS, in the LOOP_NEST. When the data references in DATAREFS, in the LOOP_NEST. When
COMPUTE_SELF_AND_READ_READ_DEPENDENCES is FALSE, don't compute COMPUTE_SELF_AND_RR is FALSE, don't compute read-read and self
read-read and self relations. */ relations. */
static void static void
compute_all_dependences (varray_type datarefs, compute_all_dependences (VEC (data_reference_p, heap) *datarefs,
VEC(ddr_p,heap) **dependence_relations, VEC (ddr_p, heap) *dependence_relations,
VEC (loop_p, heap) *loop_nest, 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 for (i = 0; VEC_iterate (data_reference_p, datarefs, i, a); i++)
use compute_self_dependence below. */ 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++) if (compute_self_and_rr)
for (j = i + 1; j < N; j++) for (i = 0; VEC_iterate (data_reference_p, datarefs, i, a); i++)
{ {
struct data_reference *a, *b; ddr = initialize_data_dependence_relation (a, a, loop_nest);
struct data_dependence_relation *ddr; VEC_safe_push (ddr_p, heap, dependence_relations, ddr);
compute_self_dependence (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);
} }
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 /* Search the data references in LOOP, and record the information into
...@@ -3991,7 +3967,8 @@ compute_all_dependences (varray_type datarefs, ...@@ -3991,7 +3967,8 @@ compute_all_dependences (varray_type datarefs,
arithmetic as if they were array accesses, etc. */ arithmetic as if they were array accesses, etc. */
tree 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; basic_block bb, *bbs;
unsigned int i; unsigned int i;
...@@ -4035,7 +4012,7 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs) ...@@ -4035,7 +4012,7 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs)
dr = create_data_ref (opnd0, stmt, false); dr = create_data_ref (opnd0, stmt, false);
if (dr) if (dr)
{ {
VARRAY_PUSH_GENERIC_PTR (*datarefs, dr); VEC_safe_push (data_reference_p, heap, datarefs, dr);
one_inserted = true; one_inserted = true;
} }
} }
...@@ -4047,7 +4024,7 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs) ...@@ -4047,7 +4024,7 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs)
dr = create_data_ref (opnd1, stmt, true); dr = create_data_ref (opnd1, stmt, true);
if (dr) if (dr)
{ {
VARRAY_PUSH_GENERIC_PTR (*datarefs, dr); VEC_safe_push (data_reference_p, heap, datarefs, dr);
one_inserted = true; one_inserted = true;
} }
} }
...@@ -4072,7 +4049,7 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs) ...@@ -4072,7 +4049,7 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs)
dr = create_data_ref (TREE_VALUE (args), stmt, true); dr = create_data_ref (TREE_VALUE (args), stmt, true);
if (dr) if (dr)
{ {
VARRAY_PUSH_GENERIC_PTR (*datarefs, dr); VEC_safe_push (data_reference_p, heap, datarefs, dr);
one_inserted = true; one_inserted = true;
} }
} }
...@@ -4103,7 +4080,7 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs) ...@@ -4103,7 +4080,7 @@ find_data_references_in_loop (struct loop *loop, varray_type *datarefs)
DR_OFFSET_MISALIGNMENT (res) = NULL_TREE; DR_OFFSET_MISALIGNMENT (res) = NULL_TREE;
DR_MEMTAG (res) = NULL_TREE; DR_MEMTAG (res) = NULL_TREE;
DR_PTR_INFO (res) = NULL; DR_PTR_INFO (res) = NULL;
VARRAY_PUSH_GENERIC_PTR (*datarefs, res); VEC_safe_push (data_reference_p, heap, datarefs, res);
free (bbs); free (bbs);
return chrec_dont_know; return chrec_dont_know;
...@@ -4164,20 +4141,17 @@ find_loop_nest (struct loop *loop, VEC (loop_p, heap) *loop_nest) ...@@ -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: /* Given a loop nest LOOP, the following vectors are returned:
*DATAREFS is initialized to all the array elements contained in this loop, DATAREFS is initialized to all the array elements contained in this loop,
*DEPENDENCE_RELATIONS contains the relations between the data references. DEPENDENCE_RELATIONS contains the relations between the data references.
Compute read-read and self relations if Compute read-read and self relations if
COMPUTE_SELF_AND_READ_READ_DEPENDENCES is TRUE. */ COMPUTE_SELF_AND_READ_READ_DEPENDENCES is TRUE. */
void void
compute_data_dependences_for_loop (struct loop *loop, compute_data_dependences_for_loop (struct loop *loop,
bool compute_self_and_read_read_dependences, bool compute_self_and_read_read_dependences,
varray_type *datarefs, VEC (data_reference_p, heap) *datarefs,
varray_type *dependence_relations) VEC (ddr_p, heap) *dependence_relations)
{ {
unsigned int i;
VEC(ddr_p,heap) *allrelations;
struct data_dependence_relation *ddr;
struct loop *loop_nest = loop; struct loop *loop_nest = loop;
VEC (loop_p, heap) *vloops = VEC_alloc (loop_p, heap, 3); VEC (loop_p, heap) *vloops = VEC_alloc (loop_p, heap, 3);
...@@ -4195,20 +4169,11 @@ compute_data_dependences_for_loop (struct loop *loop, ...@@ -4195,20 +4169,11 @@ compute_data_dependences_for_loop (struct loop *loop,
/* Insert a single relation into dependence_relations: /* Insert a single relation into dependence_relations:
chrec_dont_know. */ chrec_dont_know. */
ddr = initialize_data_dependence_relation (NULL, NULL, vloops); 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 else
{ compute_all_dependences (datarefs, dependence_relations, vloops,
allrelations = NULL; compute_self_and_read_read_dependences);
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);
}
if (dump_file && (dump_flags & TDF_STATS)) if (dump_file && (dump_flags & TDF_STATS))
{ {
...@@ -4285,18 +4250,15 @@ static void ...@@ -4285,18 +4250,15 @@ static void
analyze_all_data_dependences (struct loops *loops) analyze_all_data_dependences (struct loops *loops)
{ {
unsigned int i; unsigned int i;
varray_type datarefs;
varray_type dependence_relations;
int nb_data_refs = 10; int nb_data_refs = 10;
VEC (data_reference_p, heap) *datarefs =
VARRAY_GENERIC_PTR_INIT (datarefs, nb_data_refs, "datarefs"); VEC_alloc (data_reference_p, heap, nb_data_refs);
VARRAY_GENERIC_PTR_INIT (dependence_relations, VEC (ddr_p, heap) *dependence_relations =
nb_data_refs * nb_data_refs, VEC_alloc (ddr_p, heap, nb_data_refs * nb_data_refs);
"dependence_relations");
/* Compute DDs on the whole function. */ /* Compute DDs on the whole function. */
compute_data_dependences_for_loop (loops->parray[0], false, compute_data_dependences_for_loop (loops->parray[0], false,
&datarefs, &dependence_relations); datarefs, dependence_relations);
if (dump_file) if (dump_file)
{ {
...@@ -4312,12 +4274,10 @@ analyze_all_data_dependences (struct loops *loops) ...@@ -4312,12 +4274,10 @@ analyze_all_data_dependences (struct loops *loops)
unsigned nb_bot_relations = 0; unsigned nb_bot_relations = 0;
unsigned nb_basename_differ = 0; unsigned nb_basename_differ = 0;
unsigned nb_chrec_relations = 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))) if (chrec_contains_undetermined (DDR_ARE_DEPENDENT (ddr)))
nb_top_relations++; nb_top_relations++;
...@@ -4358,7 +4318,8 @@ free_dependence_relation (struct data_dependence_relation *ddr) ...@@ -4358,7 +4318,8 @@ free_dependence_relation (struct data_dependence_relation *ddr)
return; return;
if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE && DDR_SUBSCRIPTS (ddr)) 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); free (ddr);
} }
...@@ -4366,37 +4327,34 @@ free_dependence_relation (struct data_dependence_relation *ddr) ...@@ -4366,37 +4327,34 @@ free_dependence_relation (struct data_dependence_relation *ddr)
DEPENDENCE_RELATIONS. */ DEPENDENCE_RELATIONS. */
void void
free_dependence_relations (varray_type dependence_relations) free_dependence_relations (VEC (ddr_p, heap) *dependence_relations)
{ {
unsigned int i; unsigned int i;
if (dependence_relations == NULL) struct data_dependence_relation *ddr;
return;
for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_relations); i++) for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++)
free_dependence_relation (VARRAY_GENERIC_PTR (dependence_relations, i)); free_dependence_relation (ddr);
varray_clear (dependence_relations);
VEC_free (ddr_p, heap, dependence_relations);
} }
/* Free the memory used by the data references from DATAREFS. */ /* Free the memory used by the data references from DATAREFS. */
void void
free_data_refs (varray_type datarefs) free_data_refs (VEC (data_reference_p, heap) *datarefs)
{ {
unsigned int i; unsigned int i;
struct data_reference *dr;
if (datarefs == NULL)
return;
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 *) if (DR_TYPE(dr) == ARRAY_REF_TYPE)
VARRAY_GENERIC_PTR (datarefs, i); VEC_free (tree, heap, (dr)->object_info.access_fns);
if (dr) else
{ VEC_free (tree, heap, (dr)->first_location.access_fns);
DR_FREE_ACCESS_FNS (dr);
free (dr); free (dr);
}
} }
varray_clear (datarefs); VEC_free (data_reference_p, heap, datarefs);
} }
...@@ -107,6 +107,10 @@ struct data_reference ...@@ -107,6 +107,10 @@ struct data_reference
enum data_ref_type type; 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_STMT(DR) (DR)->stmt
#define DR_REF(DR) (DR)->ref #define DR_REF(DR) (DR)->ref
#define DR_BASE_OBJECT(DR) (DR)->object_info.base_object #define DR_BASE_OBJECT(DR) (DR)->object_info.base_object
...@@ -181,6 +185,10 @@ struct subscript ...@@ -181,6 +185,10 @@ struct subscript
tree distance; 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_A(SUB) SUB->conflicting_iterations_in_a
#define SUB_CONFLICTS_IN_B(SUB) SUB->conflicting_iterations_in_b #define SUB_CONFLICTS_IN_B(SUB) SUB->conflicting_iterations_in_b
#define SUB_LAST_CONFLICT(SUB) SUB->last_conflict #define SUB_LAST_CONFLICT(SUB) SUB->last_conflict
...@@ -219,16 +227,16 @@ struct data_dependence_relation ...@@ -219,16 +227,16 @@ struct data_dependence_relation
/* For each subscript in the dependence test, there is an element in /* 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 this array. This is the attribute that labels the edge A->B of
the data_dependence_relation. */ the data_dependence_relation. */
varray_type subscripts; VEC (subscript_p, heap) *subscripts;
/* The analyzed loop nest. */ /* The analyzed loop nest. */
VEC (loop_p, heap) *loop_nest; VEC (loop_p, heap) *loop_nest;
/* The classic direction vector. */ /* The classic direction vector. */
VEC(lambda_vector,heap) *dir_vects; VEC (lambda_vector, heap) *dir_vects;
/* The classic distance vector. */ /* The classic distance vector. */
VEC(lambda_vector,heap) *dist_vects; VEC (lambda_vector, heap) *dist_vects;
}; };
typedef struct data_dependence_relation *ddr_p; typedef struct data_dependence_relation *ddr_p;
...@@ -240,10 +248,8 @@ DEF_VEC_ALLOC_P(ddr_p,heap); ...@@ -240,10 +248,8 @@ DEF_VEC_ALLOC_P(ddr_p,heap);
#define DDR_AFFINE_P(DDR) DDR->affine_p #define DDR_AFFINE_P(DDR) DDR->affine_p
#define DDR_ARE_DEPENDENT(DDR) DDR->are_dependent #define DDR_ARE_DEPENDENT(DDR) DDR->are_dependent
#define DDR_SUBSCRIPTS(DDR) DDR->subscripts #define DDR_SUBSCRIPTS(DDR) DDR->subscripts
#define DDR_SUBSCRIPTS_VECTOR_INIT(DDR, N) \ #define DDR_SUBSCRIPT(DDR, I) VEC_index (subscript_p, DDR_SUBSCRIPTS (DDR), I)
VARRAY_GENERIC_PTR_INIT (DDR_SUBSCRIPTS (DDR), N, "subscripts_vector"); #define DDR_NUM_SUBSCRIPTS(DDR) VEC_length (subscript_p, DDR_SUBSCRIPTS (DDR))
#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_LOOP_NEST(DDR) DDR->loop_nest #define DDR_LOOP_NEST(DDR) DDR->loop_nest
/* The size of the direction/distance vectors: the number of loops in /* The size of the direction/distance vectors: the number of loops in
...@@ -263,29 +269,32 @@ DEF_VEC_ALLOC_P(ddr_p,heap); ...@@ -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, 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_direction_vector (FILE *, lambda_vector, int);
extern void print_dir_vectors (FILE *, VEC (lambda_vector, heap) *, 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 print_dist_vectors (FILE *, VEC (lambda_vector, heap) *, int);
extern void dump_subscript (FILE *, struct subscript *); extern void dump_subscript (FILE *, struct subscript *);
extern void dump_ddrs (FILE *, varray_type); extern void dump_ddrs (FILE *, VEC (ddr_p, heap) *);
extern void dump_dist_dir_vectors (FILE *, varray_type); extern void dump_dist_dir_vectors (FILE *, VEC (ddr_p, heap) *);
extern void dump_data_reference (FILE *, struct data_reference *); 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 debug_data_dependence_relation (struct data_dependence_relation *);
extern void dump_data_dependence_relation (FILE *, extern void dump_data_dependence_relation (FILE *,
struct data_dependence_relation *); 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 *, extern void dump_data_dependence_direction (FILE *,
enum data_dependence_direction); enum data_dependence_direction);
extern void free_dependence_relation (struct data_dependence_relation *); extern void free_dependence_relation (struct data_dependence_relation *);
extern void free_dependence_relations (varray_type); extern void free_dependence_relations (VEC (ddr_p, heap) *);
extern void free_data_refs (varray_type); extern void free_data_refs (VEC (data_reference_p, heap) *);
extern struct data_reference *analyze_array (tree, tree, bool); extern struct data_reference *analyze_array (tree, tree, bool);
extern void estimate_iters_using_array (tree, tree); extern void estimate_iters_using_array (tree, tree);
/* Return the index of the variable VAR in the LOOP_NEST array. */ /* Return the index of the variable VAR in the LOOP_NEST array. */
static inline int static inline int
...@@ -302,6 +311,7 @@ index_in_loop_nest (int var, VEC (loop_p, heap) *loop_nest) ...@@ -302,6 +311,7 @@ index_in_loop_nest (int var, VEC (loop_p, heap) *loop_nest)
return var_index; 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 */ #endif /* GCC_TREE_DATA_REF_H */
...@@ -41,7 +41,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -41,7 +41,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "tree-data-ref.h" #include "tree-data-ref.h"
#include "tree-scalar-evolution.h" #include "tree-scalar-evolution.h"
#include "tree-pass.h" #include "tree-pass.h"
#include "varray.h"
#include "lambda.h" #include "lambda.h"
/* Linear loop transforms include any composition of interchange, /* Linear loop transforms include any composition of interchange,
...@@ -90,8 +89,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -90,8 +89,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
*/ */
static void static void
gather_interchange_stats (varray_type dependence_relations, gather_interchange_stats (VEC (ddr_p, heap) *dependence_relations,
varray_type datarefs, VEC (data_reference_p, heap) *datarefs,
struct loop *loop, struct loop *loop,
struct loop *first_loop, struct loop *first_loop,
unsigned int *dependence_steps, unsigned int *dependence_steps,
...@@ -99,17 +98,15 @@ gather_interchange_stats (varray_type dependence_relations, ...@@ -99,17 +98,15 @@ gather_interchange_stats (varray_type dependence_relations,
unsigned int *access_strides) unsigned int *access_strides)
{ {
unsigned int i, j; unsigned int i, j;
struct data_dependence_relation *ddr;
struct data_reference *dr;
*dependence_steps = 0; *dependence_steps = 0;
*nb_deps_not_carried_by_loop = 0; *nb_deps_not_carried_by_loop = 0;
*access_strides = 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 /* 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 vector is NULL, or there is no dependence, then there is no reuse of
data. */ data. */
...@@ -134,10 +131,9 @@ gather_interchange_stats (varray_type dependence_relations, ...@@ -134,10 +131,9 @@ gather_interchange_stats (varray_type dependence_relations,
} }
/* Compute the access strides. */ /* 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; unsigned int it;
struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i);
tree stmt = DR_STMT (dr); tree stmt = DR_STMT (dr);
struct loop *stmt_loop = loop_containing_stmt (stmt); struct loop *stmt_loop = loop_containing_stmt (stmt);
struct loop *inner_loop = first_loop->inner; struct loop *inner_loop = first_loop->inner;
...@@ -171,8 +167,8 @@ gather_interchange_stats (varray_type dependence_relations, ...@@ -171,8 +167,8 @@ gather_interchange_stats (varray_type dependence_relations,
static lambda_trans_matrix static lambda_trans_matrix
try_interchange_loops (lambda_trans_matrix trans, try_interchange_loops (lambda_trans_matrix trans,
unsigned int depth, unsigned int depth,
varray_type dependence_relations, VEC (ddr_p, heap) *dependence_relations,
varray_type datarefs, VEC (data_reference_p, heap) *datarefs,
struct loop *first_loop) struct loop *first_loop)
{ {
struct loop *loop_i; struct loop *loop_i;
...@@ -184,8 +180,7 @@ try_interchange_loops (lambda_trans_matrix trans, ...@@ -184,8 +180,7 @@ try_interchange_loops (lambda_trans_matrix trans,
/* When there is an unknown relation in the dependence_relations, we /* When there is an unknown relation in the dependence_relations, we
know that it is no worth looking at this loop nest: give up. */ know that it is no worth looking at this loop nest: give up. */
ddr = (struct data_dependence_relation *) ddr = VEC_index (ddr_p, dependence_relations, 0);
VARRAY_GENERIC_PTR (dependence_relations, 0);
if (ddr == NULL || DDR_ARE_DEPENDENT (ddr) == chrec_dont_know) if (ddr == NULL || DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
return trans; return trans;
...@@ -250,8 +245,8 @@ linear_transform_loops (struct loops *loops) ...@@ -250,8 +245,8 @@ linear_transform_loops (struct loops *loops)
for (i = 1; i < loops->num; i++) for (i = 1; i < loops->num; i++)
{ {
unsigned int depth = 0; unsigned int depth = 0;
varray_type datarefs; VEC (ddr_p, heap) *dependence_relations;
varray_type dependence_relations; VEC (data_reference_p, heap) *datarefs;
struct loop *loop_nest = loops->parray[i]; struct loop *loop_nest = loops->parray[i];
struct loop *temp; struct loop *temp;
lambda_loopnest before, after; lambda_loopnest before, after;
...@@ -292,31 +287,17 @@ linear_transform_loops (struct loops *loops) ...@@ -292,31 +287,17 @@ linear_transform_loops (struct loops *loops)
/* Analyze data references and dependence relations using scev. */ /* Analyze data references and dependence relations using scev. */
VARRAY_GENERIC_PTR_INIT (datarefs, 10, "datarefs"); datarefs = VEC_alloc (data_reference_p, heap, 10);
VARRAY_GENERIC_PTR_INIT (dependence_relations, 10, dependence_relations = VEC_alloc (ddr_p, heap, 10 * 10);
"dependence_relations"); compute_data_dependences_for_loop (loop_nest, true, datarefs,
dependence_relations);
compute_data_dependences_for_loop (loop_nest, true,
&datarefs, &dependence_relations);
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ dump_ddrs (dump_file, dependence_relations);
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);
if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE)
dump_data_dependence_relation (dump_file, ddr);
}
fprintf (dump_file, "\n\n");
}
/* Build the transformation matrix. */ /* Build the transformation matrix. */
trans = lambda_trans_matrix_new (depth, depth); trans = lambda_trans_matrix_new (depth, depth);
lambda_matrix_id (LTM_MATRIX (trans), depth); lambda_matrix_id (LTM_MATRIX (trans), depth);
trans = try_interchange_loops (trans, depth, dependence_relations, trans = try_interchange_loops (trans, depth, dependence_relations,
datarefs, loop_nest); datarefs, loop_nest);
...@@ -334,8 +315,10 @@ linear_transform_loops (struct loops *loops) ...@@ -334,8 +315,10 @@ linear_transform_loops (struct loops *loops)
fprintf (dump_file, "Can't transform loop, transform is illegal:\n"); fprintf (dump_file, "Can't transform loop, transform is illegal:\n");
continue; continue;
} }
if (!perfect_nest_p (loop_nest)) if (!perfect_nest_p (loop_nest))
need_perfect_nest = true; need_perfect_nest = true;
before = gcc_loopnest_to_lambda_loopnest (loops, before = gcc_loopnest_to_lambda_loopnest (loops,
loop_nest, &oldivs, loop_nest, &oldivs,
&invariants, &invariants,
...@@ -350,18 +333,23 @@ linear_transform_loops (struct loops *loops) ...@@ -350,18 +333,23 @@ linear_transform_loops (struct loops *loops)
} }
after = lambda_loopnest_transform (before, trans); after = lambda_loopnest_transform (before, trans);
if (dump_file) if (dump_file)
{ {
fprintf (dump_file, "After:\n"); fprintf (dump_file, "After:\n");
print_lambda_loopnest (dump_file, after, 'u'); print_lambda_loopnest (dump_file, after, 'u');
} }
lambda_loopnest_to_gcc_loopnest (loop_nest, oldivs, invariants, lambda_loopnest_to_gcc_loopnest (loop_nest, oldivs, invariants,
after, trans); after, trans);
if (dump_file) if (dump_file)
fprintf (dump_file, "Successfully transformed loop.\n"); fprintf (dump_file, "Successfully transformed loop.\n");
free_dependence_relations (dependence_relations); free_dependence_relations (dependence_relations);
free_data_refs (datarefs); free_data_refs (datarefs);
} }
VEC_free (tree, heap, oldivs); VEC_free (tree, heap, oldivs);
VEC_free (tree, heap, invariants); VEC_free (tree, heap, invariants);
scev_reset (); scev_reset ();
......
...@@ -679,18 +679,15 @@ static bool ...@@ -679,18 +679,15 @@ static bool
vect_analyze_data_ref_dependences (loop_vec_info loop_vinfo) vect_analyze_data_ref_dependences (loop_vec_info loop_vinfo)
{ {
unsigned int i; 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)) if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "=== vect_analyze_dependences ==="); fprintf (vect_dump, "=== vect_analyze_dependences ===");
for (i = 0; i < VARRAY_ACTIVE_SIZE (ddrs); i++) for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++)
{ if (vect_analyze_data_ref_dependence (ddr, loop_vinfo))
struct data_dependence_relation *ddr = VARRAY_GENERIC_PTR (ddrs, i); return false;
if (vect_analyze_data_ref_dependence (ddr, loop_vinfo))
return false;
}
return true; return true;
} }
...@@ -812,15 +809,13 @@ vect_compute_data_ref_alignment (struct data_reference *dr) ...@@ -812,15 +809,13 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
static bool static bool
vect_compute_data_refs_alignment (loop_vec_info loop_vinfo) 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; unsigned int i;
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{ if (!vect_compute_data_ref_alignment (dr))
struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i); return false;
if (!vect_compute_data_ref_alignment (dr))
return false;
}
return true; return true;
} }
...@@ -884,13 +879,13 @@ vect_update_misalignment_for_peel (struct data_reference *dr, ...@@ -884,13 +879,13 @@ vect_update_misalignment_for_peel (struct data_reference *dr,
static bool static bool
vect_verify_datarefs_alignment (loop_vec_info loop_vinfo) 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; enum dr_alignment_support supportable_dr_alignment;
unsigned int i; 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); supportable_dr_alignment = vect_supportable_dr_alignment (dr);
if (!supportable_dr_alignment) if (!supportable_dr_alignment)
{ {
...@@ -1007,7 +1002,7 @@ vect_verify_datarefs_alignment (loop_vec_info loop_vinfo) ...@@ -1007,7 +1002,7 @@ vect_verify_datarefs_alignment (loop_vec_info loop_vinfo)
static bool static bool
vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) 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; enum dr_alignment_support supportable_dr_alignment;
struct data_reference *dr0 = NULL; struct data_reference *dr0 = NULL;
struct data_reference *dr; struct data_reference *dr;
...@@ -1055,16 +1050,13 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) ...@@ -1055,16 +1050,13 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
TODO: Use a cost model. */ TODO: Use a cost model. */
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{ if (!DR_IS_READ (dr) && !aligned_access_p (dr))
dr = VARRAY_GENERIC_PTR (datarefs, i); {
if (!DR_IS_READ (dr) && !aligned_access_p (dr)) dr0 = dr;
{ do_peeling = true;
dr0 = dr; break;
do_peeling = true; }
break;
}
}
/* Often peeling for alignment will require peeling for loop-bound, which in /* 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. */ 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) ...@@ -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. */ /* 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; int save_misalignment;
dr = VARRAY_GENERIC_PTR (datarefs, i);
if (dr == dr0) if (dr == dr0)
continue; continue;
save_misalignment = DR_MISALIGNMENT (dr); save_misalignment = DR_MISALIGNMENT (dr);
vect_update_misalignment_for_peel (dr, dr0, npeel); vect_update_misalignment_for_peel (dr, dr0, npeel);
supportable_dr_alignment = vect_supportable_dr_alignment (dr); supportable_dr_alignment = vect_supportable_dr_alignment (dr);
...@@ -1116,13 +1108,9 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) ...@@ -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 by the peeling factor times the element size of DR_i (MOD the
vectorization factor times the size). Otherwise, the vectorization factor times the size). Otherwise, the
misalignment of DR_i must be set to unknown. */ misalignment of DR_i must be set to unknown. */
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{ if (dr != dr0)
dr = VARRAY_GENERIC_PTR (datarefs, i);
if (dr == dr0)
continue;
vect_update_misalignment_for_peel (dr, dr0, npeel); vect_update_misalignment_for_peel (dr, dr0, npeel);
}
LOOP_VINFO_UNALIGNED_DR (loop_vinfo) = dr0; LOOP_VINFO_UNALIGNED_DR (loop_vinfo) = dr0;
LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo) = DR_MISALIGNMENT (dr0); LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo) = DR_MISALIGNMENT (dr0);
...@@ -1154,10 +1142,8 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) ...@@ -1154,10 +1142,8 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
if (do_versioning) 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)) if (aligned_access_p (dr))
continue; continue;
...@@ -1303,21 +1289,19 @@ static bool ...@@ -1303,21 +1289,19 @@ static bool
vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo) vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo)
{ {
unsigned int i; 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)) if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "=== vect_analyze_data_ref_accesses ==="); fprintf (vect_dump, "=== vect_analyze_data_ref_accesses ===");
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{ if (!vect_analyze_data_ref_access (dr))
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.");
if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS)) return false;
fprintf (vect_dump, "not vectorized: complicated access pattern."); }
return false;
}
}
return true; return true;
} }
...@@ -1342,22 +1326,23 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo) ...@@ -1342,22 +1326,23 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
{ {
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
unsigned int i; unsigned int i;
varray_type datarefs; VEC (data_reference_p, heap) *datarefs;
struct data_reference *dr;
tree scalar_type; tree scalar_type;
if (vect_print_dump_info (REPORT_DETAILS)) if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "=== vect_analyze_data_refs ==="); fprintf (vect_dump, "=== vect_analyze_data_refs ===");
compute_data_dependences_for_loop (loop, false, compute_data_dependences_for_loop (loop, false,
&(LOOP_VINFO_DATAREFS (loop_vinfo)), LOOP_VINFO_DATAREFS (loop_vinfo),
&(LOOP_VINFO_DDRS (loop_vinfo))); LOOP_VINFO_DDRS (loop_vinfo));
/* Go through the data-refs, check that the analysis succeeded. Update pointer /* Go through the data-refs, check that the analysis succeeded. Update pointer
from stmt_vec_info struct to DR and vectype. */ from stmt_vec_info struct to DR and vectype. */
datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); 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; tree stmt;
stmt_vec_info stmt_info; stmt_vec_info stmt_info;
......
...@@ -2769,16 +2769,14 @@ static void ...@@ -2769,16 +2769,14 @@ static void
vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters) vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters)
{ {
unsigned int i; 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)) if (vect_dump && (dump_flags & TDF_DETAILS))
fprintf (vect_dump, "=== vect_update_inits_of_dr ==="); fprintf (vect_dump, "=== vect_update_inits_of_dr ===");
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++) for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{ vect_update_init_of_dr (dr, niters);
struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i);
vect_update_init_of_dr (dr, niters);
}
} }
......
...@@ -1420,8 +1420,8 @@ new_loop_vec_info (struct loop *loop) ...@@ -1420,8 +1420,8 @@ new_loop_vec_info (struct loop *loop)
LOOP_VINFO_VECTORIZABLE_P (res) = 0; LOOP_VINFO_VECTORIZABLE_P (res) = 0;
LOOP_PEELING_FOR_ALIGNMENT (res) = 0; LOOP_PEELING_FOR_ALIGNMENT (res) = 0;
LOOP_VINFO_VECT_FACTOR (res) = 0; LOOP_VINFO_VECT_FACTOR (res) = 0;
VARRAY_GENERIC_PTR_INIT (LOOP_VINFO_DATAREFS (res), 20, "loop_datarefs"); LOOP_VINFO_DATAREFS (res) = VEC_alloc (data_reference_p, heap, 10);
VARRAY_GENERIC_PTR_INIT (LOOP_VINFO_DDRS (res), 20, "loop_ddrs"); LOOP_VINFO_DDRS (res) = VEC_alloc (ddr_p, heap, 10 * 10);
LOOP_VINFO_UNALIGNED_DR (res) = NULL; LOOP_VINFO_UNALIGNED_DR (res) = NULL;
LOOP_VINFO_MAY_MISALIGN_STMTS (res) LOOP_VINFO_MAY_MISALIGN_STMTS (res)
= VEC_alloc (tree, heap, PARAM_VALUE (PARAM_VECT_MAX_VERSION_CHECKS)); = VEC_alloc (tree, heap, PARAM_VALUE (PARAM_VECT_MAX_VERSION_CHECKS));
...@@ -1483,8 +1483,8 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo) ...@@ -1483,8 +1483,8 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo)
} }
free (LOOP_VINFO_BBS (loop_vinfo)); free (LOOP_VINFO_BBS (loop_vinfo));
varray_clear (LOOP_VINFO_DATAREFS (loop_vinfo)); free_data_refs (LOOP_VINFO_DATAREFS (loop_vinfo));
varray_clear (LOOP_VINFO_DDRS (loop_vinfo)); free_dependence_relations (LOOP_VINFO_DDRS (loop_vinfo));
VEC_free (tree, heap, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo)); VEC_free (tree, heap, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo));
free (loop_vinfo); free (loop_vinfo);
......
...@@ -122,10 +122,10 @@ typedef struct _loop_vec_info { ...@@ -122,10 +122,10 @@ typedef struct _loop_vec_info {
int ptr_mask; int ptr_mask;
/* All data references in the loop. */ /* All data references in the loop. */
varray_type datarefs; VEC (data_reference_p, heap) *datarefs;
/* All data dependences in the loop. */ /* 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 /* Statements in the loop that have data references that are candidates for a
runtime (loop versioning) misalignment check. */ runtime (loop versioning) misalignment check. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment