Commit ba42e045 by Sebastian Pop Committed by Sebastian Pop

tree-data-ref.c: Rename DDR_SIZE_VECT to DDR_NB_LOOPS.

	* tree-data-ref.c: Rename DDR_SIZE_VECT to DDR_NB_LOOPS.
	(subscript_dependence_tester_1): Declared.
	(print_dir_vectors, print_dist_vectors): New.
	(debug_data_dependence_relation): New.
	(dump_data_dependence_relation): Print more details.
	(initialize_data_dependence_relation): Initialize DDR_LOOP_NEST.
	(analyze_subscript_affine_affine): Don't ICE when gcd_alpha_beta is 0.
	(save_dist_v, save_dir_v, add_outer_distances,
	build_classic_dist_vector_1): New.
	(build_classic_dist_vector): Rewrite to work on DDR_LOOP_NEST.
	Don't test for lambda_vector_lexico_pos.
	(same_access_functions, add_multivariate_self_dist,
	add_other_self_distances, dir_from_dist): New.
	(build_classic_dir_vector): Replace implementation almost identical to 
	build_classic_dist_vector with a walk of DDR_DIST_VECTS with a call to
	dir_from_dist.
	(subscript_dependence_tester_1): New.
	(subscript_dependence_tester): Handle the lexicographically negative
	distance vectors by recomputing the dependence relation.
	(compute_affine_dependence): Remove parameter loop_nest_depth.
	(compute_self_dependence): Don't call compute_subscript_distance.
	(compute_all_dependences): Remove parameters nb_loops, loop_nest_depth.
	Add a parameter for the loop_nest.
	(find_loop_nest_1, find_loop_nest): New.
	(compute_data_dependences_for_loop): Compute the loop nest, and give
	up if the nest is not well formed.
	* tree-data-ref.h (loop_p): New.
	(struct data_dependence_relation): Replace size_vect field with 
	loop_nest, a vec of loops.
	(DDR_SIZE_VECT): Renamed DDR_NB_LOOPS.
	(DDR_LOOP_NEST): New.
	(print_dir_vectors, print_dist_vectors,
	debug_data_dependence_relation): Declared.
	(index_in_loop_nest): New.
	* tree-vect-analyze.c (vect_analyze_data_ref_dependence): Use
	DDR_LOOP_NEST and index_in_loop_nest to determine the dependence
	distance.

From-SVN: r112399
parent 0535d6d7
2006-03-26 Sebastian Pop <pop@cri.ensmp.fr>
* tree-data-ref.c: Rename DDR_SIZE_VECT to DDR_NB_LOOPS.
(subscript_dependence_tester_1): Declared.
(print_dir_vectors, print_dist_vectors): New.
(debug_data_dependence_relation): New.
(dump_data_dependence_relation): Print more details.
(initialize_data_dependence_relation): Initialize DDR_LOOP_NEST.
(analyze_subscript_affine_affine): Don't ICE when gcd_alpha_beta is 0.
(save_dist_v, save_dir_v, add_outer_distances,
build_classic_dist_vector_1): New.
(build_classic_dist_vector): Rewrite to work on DDR_LOOP_NEST.
Don't test for lambda_vector_lexico_pos.
(same_access_functions, add_multivariate_self_dist,
add_other_self_distances, dir_from_dist): New.
(build_classic_dir_vector): Replace implementation almost identical to
build_classic_dist_vector with a walk of DDR_DIST_VECTS with a call to
dir_from_dist.
(subscript_dependence_tester_1): New.
(subscript_dependence_tester): Handle the lexicographically negative
distance vectors by recomputing the dependence relation.
(compute_affine_dependence): Remove parameter loop_nest_depth.
(compute_self_dependence): Don't call compute_subscript_distance.
(compute_all_dependences): Remove parameters nb_loops, loop_nest_depth.
Add a parameter for the loop_nest.
(find_loop_nest_1, find_loop_nest): New.
(compute_data_dependences_for_loop): Compute the loop nest, and give
up if the nest is not well formed.
* tree-data-ref.h (loop_p): New.
(struct data_dependence_relation): Replace size_vect field with
loop_nest, a vec of loops.
(DDR_SIZE_VECT): Renamed DDR_NB_LOOPS.
(DDR_LOOP_NEST): New.
(print_dir_vectors, print_dist_vectors,
debug_data_dependence_relation): Declared.
(index_in_loop_nest): New.
* tree-vect-analyze.c (vect_analyze_data_ref_dependence): Use
DDR_LOOP_NEST and index_in_loop_nest to determine the dependence
distance.
2006-03-25 Adam Nemet <anemet@caviumnetworks.com> 2006-03-25 Adam Nemet <anemet@caviumnetworks.com>
* simplify-rtx.c (simplify_relational_operation): Call * simplify-rtx.c (simplify_relational_operation): Call
......
...@@ -186,6 +186,10 @@ struct subscript ...@@ -186,6 +186,10 @@ struct subscript
#define SUB_LAST_CONFLICT(SUB) SUB->last_conflict #define SUB_LAST_CONFLICT(SUB) SUB->last_conflict
#define SUB_DISTANCE(SUB) SUB->distance #define SUB_DISTANCE(SUB) SUB->distance
typedef struct loop *loop_p;
DEF_VEC_P(loop_p);
DEF_VEC_ALLOC_P (loop_p, heap);
/* A data_dependence_relation represents a relation between two /* A data_dependence_relation represents a relation between two
data_references A and B. */ data_references A and B. */
...@@ -217,9 +221,8 @@ struct data_dependence_relation ...@@ -217,9 +221,8 @@ struct data_dependence_relation
the data_dependence_relation. */ the data_dependence_relation. */
varray_type subscripts; varray_type subscripts;
/* The size of the direction/distance vectors: the depth of the /* The analyzed loop nest. */
analyzed loop nest. */ VEC (loop_p, heap) *loop_nest;
int size_vect;
/* The classic direction vector. */ /* The classic direction vector. */
VEC(lambda_vector,heap) *dir_vects; VEC(lambda_vector,heap) *dir_vects;
...@@ -241,7 +244,11 @@ DEF_VEC_ALLOC_P(ddr_p,heap); ...@@ -241,7 +244,11 @@ DEF_VEC_ALLOC_P(ddr_p,heap);
VARRAY_GENERIC_PTR_INIT (DDR_SUBSCRIPTS (DDR), N, "subscripts_vector"); VARRAY_GENERIC_PTR_INIT (DDR_SUBSCRIPTS (DDR), N, "subscripts_vector");
#define DDR_SUBSCRIPT(DDR, I) VARRAY_GENERIC_PTR (DDR_SUBSCRIPTS (DDR), I) #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_NUM_SUBSCRIPTS(DDR) VARRAY_ACTIVE_SIZE (DDR_SUBSCRIPTS (DDR))
#define DDR_SIZE_VECT(DDR) DDR->size_vect
#define DDR_LOOP_NEST(DDR) DDR->loop_nest
/* The size of the direction/distance vectors: the number of loops in
the loop nest. */
#define DDR_NB_LOOPS(DDR) (VEC_length (loop_p, DDR_LOOP_NEST (DDR)))
#define DDR_DIST_VECTS(DDR) ((DDR)->dist_vects) #define DDR_DIST_VECTS(DDR) ((DDR)->dist_vects)
#define DDR_DIR_VECTS(DDR) ((DDR)->dir_vects) #define DDR_DIR_VECTS(DDR) ((DDR)->dir_vects)
...@@ -260,11 +267,14 @@ extern tree find_data_references_in_loop (struct loop *, varray_type *); ...@@ -260,11 +267,14 @@ extern tree find_data_references_in_loop (struct loop *, varray_type *);
extern void compute_data_dependences_for_loop (struct loop *, bool, extern void compute_data_dependences_for_loop (struct loop *, bool,
varray_type *, varray_type *); varray_type *, varray_type *);
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_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 *, varray_type);
extern void dump_dist_dir_vectors (FILE *, varray_type); extern void dump_dist_dir_vectors (FILE *, varray_type);
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 *, varray_type);
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 *, varray_type);
...@@ -276,6 +286,22 @@ extern void free_data_refs (varray_type); ...@@ -276,6 +286,22 @@ extern void free_data_refs (varray_type);
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. */
static inline int
index_in_loop_nest (int var, VEC (loop_p, heap) *loop_nest)
{
struct loop *loopi;
int var_index;
for (var_index = 0; VEC_iterate (loop_p, loop_nest, var_index, loopi);
var_index++)
if (loopi->num == var)
break;
return var_index;
}
#endif /* GCC_TREE_DATA_REF_H */ #endif /* GCC_TREE_DATA_REF_H */
...@@ -584,12 +584,12 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, ...@@ -584,12 +584,12 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
unsigned int i; unsigned int i;
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo); int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
unsigned int loop_depth = 0;
struct loop *loop_nest = loop;
struct data_reference *dra = DDR_A (ddr); struct data_reference *dra = DDR_A (ddr);
struct data_reference *drb = DDR_B (ddr); struct data_reference *drb = DDR_B (ddr);
stmt_vec_info stmtinfo_a = vinfo_for_stmt (DR_STMT (dra)); stmt_vec_info stmtinfo_a = vinfo_for_stmt (DR_STMT (dra));
stmt_vec_info stmtinfo_b = vinfo_for_stmt (DR_STMT (drb)); stmt_vec_info stmtinfo_b = vinfo_for_stmt (DR_STMT (drb));
lambda_vector dist_v;
unsigned int loop_depth;
if (DDR_ARE_DEPENDENT (ddr) == chrec_known) if (DDR_ARE_DEPENDENT (ddr) == chrec_known)
return false; return false;
...@@ -619,16 +619,10 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, ...@@ -619,16 +619,10 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
return true; return true;
} }
/* Find loop depth. */ loop_depth = index_in_loop_nest (loop->num, DDR_LOOP_NEST (ddr));
while (loop_nest && loop_nest->outer && loop_nest->outer->outer) for (i = 0; VEC_iterate (lambda_vector, DDR_DIST_VECTS (ddr), i, dist_v); i++)
{ {
loop_nest = loop_nest->outer; int dist = dist_v[loop_depth];
loop_depth++;
}
for (i = 0; i < DDR_NUM_DIST_VECTS (ddr); i++)
{
int dist = DDR_DIST_VECT (ddr, i)[loop_depth];
if (vect_print_dump_info (REPORT_DR_DETAILS)) if (vect_print_dump_info (REPORT_DR_DETAILS))
fprintf (vect_dump, "dependence distance = %d.", dist); fprintf (vect_dump, "dependence distance = %d.", dist);
......
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