tree-chrec.c (eq_evolutions_p): New.

* tree-chrec.c (eq_evolutions_p): New.
	* tree-chrec.h (eq_evolutions_p): Declared.
	* tree-data-ref.c: Fix formatting.
	(datadep_stats, dependence_stats): New.
	(gcd): Moved...
	(print_direction_vector): New.
	(dump_data_dependence_relation): Use print_direction_vector.
	(object_analysis, create_data_ref): Handle COMPONENT_REF.
	(compute_subscript_distance): Static.
	(initialize_data_dependence_relation): Static.  Get the number
	of loops surrounding the references from the callers, and initialize
	DDR_SIZE_VECT to nb_loops.  Use both base_addr_differ_p and
	base_object_differ_p analyzers.
	(analyze_ziv_subscript, analyze_siv_subscript_cst_affine, 
	compute_overlap_steps_for_affine_1_2,
	analyze_subscript_affine_affine): Count the classified dependences.
	Print a message when a test failed.
	(can_use_analyze_subscript_affine_affine): New.	
	(analyze_siv_subscript): Compute the data dependences on symbolic
	scevs that verify can_use_analyze_subscript_affine_affine.
	(chrec_steps_divide_constant_p): Returns true, false, or unknown.
	(analyze_miv_subscript): Update use of chrec_steps_divide_constant_p.
	Handle symbolic scevs.
	(analyze_overlapping_iterations): Let symbolic affine scevs to be
	analyzed.
	(subscript_dependence_tester): Moved...
	(build_classic_dist_vector, build_classic_dir_vector): Don't use 
	lambda_vector_clear on newly allocated vectors.  Get nb_loops from
	DDR_SIZE_VECT instead of getting it in parameter.
	(subscript_dependence_tester): ... here.  Take as a parameter 
	loop_nest_depth.  Call build_classic_dist_vector and
	build_classic_dir_vector.
	(compute_affine_dependence): Update subscript_dependence_tester 
	parameters.  Update datadep_stats counters.  Call 
	compute_subscript_distance.
	(compute_self_dependence): Save the dist and dir vectors.  Call 
	compute_subscript_distance.
	(ddr_p, DEF_VEC_P(ddr_p), DEF_VEC_ALLOC_P(ddr_p,heap)): Moved...
	(compute_all_dependences): Reorder parameters as they were before
	conversion to VEC.  Pass nb_loops and loop_nest_depth.  Don't call
	compute_subscript_distance.  Update the use of 
	compute_affine_dependence and initialize_data_dependence_relation.
	(find_data_references_in_loop): Handle COMPONENT_REF.
	(compute_data_dependences_for_loop): Initialize dependence_stats.
	Don't call build_classic_dist_vector and build_classic_dir_vector.
	Update the parameters of initialize_data_dependence_relation and 
	compute_all_dependences.  Print the statistics from datadep_stats.
	(analyze_all_data_dependences): Static.  Not used until the pass for
	checking the data dependences is contributed.
	* tree-data-ref.h (ddr_p, DEF_VEC_P(ddr_p),
	DEF_VEC_ALLOC_P(ddr_p,heap)): ... here.
	(initialize_data_dependence_relation, compute_affine_dependence, 
	analyze_all_data_dependences, compute_subscript_distance): Removed.
	(print_direction_vector): New.
	* lambda.h (gcd): ... here.
	(lambda_vector_gcd): Moved here from gcd_vector.
	* lambda-code.c (gcd, gcd_vector): Removed.
	(lambda_compute_target_space): Use lambda_vector_gcd.  Fix formatting.
	* Makefile.in (tree-vect-patterns.o): Depends on TREE_DATA_REF_H.

From-SVN: r111312
This commit is contained in:
Sebastian Pop 2006-02-20 21:25:54 +01:00 committed by Sebastian Pop
parent 643519b778
commit 0ff4040e02
8 changed files with 703 additions and 276 deletions

View File

@ -1,3 +1,65 @@
2006-02-20 Sebastian Pop <pop@cri.ensmp.fr>
* tree-chrec.c (eq_evolutions_p): New.
* tree-chrec.h (eq_evolutions_p): Declared.
* tree-data-ref.c: Fix formatting.
(datadep_stats, dependence_stats): New.
(gcd): Moved...
(print_direction_vector): New.
(dump_data_dependence_relation): Use print_direction_vector.
(object_analysis, create_data_ref): Handle COMPONENT_REF.
(compute_subscript_distance): Static.
(initialize_data_dependence_relation): Static. Get the number
of loops surrounding the references from the callers, and initialize
DDR_SIZE_VECT to nb_loops. Use both base_addr_differ_p and
base_object_differ_p analyzers.
(analyze_ziv_subscript, analyze_siv_subscript_cst_affine,
compute_overlap_steps_for_affine_1_2,
analyze_subscript_affine_affine): Count the classified dependences.
Print a message when a test failed.
(can_use_analyze_subscript_affine_affine): New.
(analyze_siv_subscript): Compute the data dependences on symbolic
scevs that verify can_use_analyze_subscript_affine_affine.
(chrec_steps_divide_constant_p): Returns true, false, or unknown.
(analyze_miv_subscript): Update use of chrec_steps_divide_constant_p.
Handle symbolic scevs.
(analyze_overlapping_iterations): Let symbolic affine scevs to be
analyzed.
(subscript_dependence_tester): Moved...
(build_classic_dist_vector, build_classic_dir_vector): Don't use
lambda_vector_clear on newly allocated vectors. Get nb_loops from
DDR_SIZE_VECT instead of getting it in parameter.
(subscript_dependence_tester): ... here. Take as a parameter
loop_nest_depth. Call build_classic_dist_vector and
build_classic_dir_vector.
(compute_affine_dependence): Update subscript_dependence_tester
parameters. Update datadep_stats counters. Call
compute_subscript_distance.
(compute_self_dependence): Save the dist and dir vectors. Call
compute_subscript_distance.
(ddr_p, DEF_VEC_P(ddr_p), DEF_VEC_ALLOC_P(ddr_p,heap)): Moved...
(compute_all_dependences): Reorder parameters as they were before
conversion to VEC. Pass nb_loops and loop_nest_depth. Don't call
compute_subscript_distance. Update the use of
compute_affine_dependence and initialize_data_dependence_relation.
(find_data_references_in_loop): Handle COMPONENT_REF.
(compute_data_dependences_for_loop): Initialize dependence_stats.
Don't call build_classic_dist_vector and build_classic_dir_vector.
Update the parameters of initialize_data_dependence_relation and
compute_all_dependences. Print the statistics from datadep_stats.
(analyze_all_data_dependences): Static. Not used until the pass for
checking the data dependences is contributed.
* tree-data-ref.h (ddr_p, DEF_VEC_P(ddr_p),
DEF_VEC_ALLOC_P(ddr_p,heap)): ... here.
(initialize_data_dependence_relation, compute_affine_dependence,
analyze_all_data_dependences, compute_subscript_distance): Removed.
(print_direction_vector): New.
* lambda.h (gcd): ... here.
(lambda_vector_gcd): Moved here from gcd_vector.
* lambda-code.c (gcd, gcd_vector): Removed.
(lambda_compute_target_space): Use lambda_vector_gcd. Fix formatting.
* Makefile.in (tree-vect-patterns.o): Depends on TREE_DATA_REF_H.
2006-02-20 Diego Novillo <dnovillo@redhat.com>
* ipa-type-escape.c: Tidy some comments and white space.

View File

@ -2057,7 +2057,7 @@ tree-vect-analyze.o: tree-vect-analyze.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
tree-vect-patterns.o: tree-vect-patterns.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) errors.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-vectorizer.h tree-data-ref.h $(EXPR_H)
tree-vectorizer.h $(TREE_DATA_REF_H) $(EXPR_H)
tree-vect-transform.o: tree-vect-transform.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(GGC_H) $(OPTABS_H) $(RECOG_H) $(TREE_H) $(RTL_H) \
$(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) \

View File

@ -1,5 +1,5 @@
/* Loop transformation code generation
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Daniel Berlin <dberlin@dberlin.org>
This file is part of GCC.
@ -441,45 +441,6 @@ lambda_lattice_compute_base (lambda_loopnest nest)
return ret;
}
/* Compute the greatest common denominator of two numbers (A and B) using
Euclid's algorithm. */
static int
gcd (int a, int b)
{
int x, y, z;
x = abs (a);
y = abs (b);
while (x > 0)
{
z = y % x;
y = x;
x = z;
}
return (y);
}
/* Compute the greatest common denominator of a VECTOR of SIZE numbers. */
static int
gcd_vector (lambda_vector vector, int size)
{
int i;
int gcd1 = 0;
if (size > 0)
{
gcd1 = vector[0];
for (i = 1; i < size; i++)
gcd1 = gcd (gcd1, vector[i]);
}
return gcd1;
}
/* Compute the least common multiple of two numbers A and B . */
static int
@ -848,7 +809,7 @@ lambda_compute_target_space (lambda_loopnest auxillary_nest,
LN_LOOPS (target_nest)[i] = target_loop;
/* Computes the gcd of the coefficients of the linear part. */
gcd1 = gcd_vector (target[i], i);
gcd1 = lambda_vector_gcd (target[i], i);
/* Include the denominator in the GCD. */
gcd1 = gcd (gcd1, determinant);
@ -911,9 +872,9 @@ lambda_compute_target_space (lambda_loopnest auxillary_nest,
}
/* Find the gcd and divide by it here, rather than doing it
at the tree level. */
gcd1 = gcd_vector (LLE_COEFFICIENTS (target_expr), depth);
gcd2 = gcd_vector (LLE_INVARIANT_COEFFICIENTS (target_expr),
invariants);
gcd1 = lambda_vector_gcd (LLE_COEFFICIENTS (target_expr), depth);
gcd2 = lambda_vector_gcd (LLE_INVARIANT_COEFFICIENTS (target_expr),
invariants);
gcd1 = gcd (gcd1, gcd2);
gcd1 = gcd (gcd1, LLE_CONSTANT (target_expr));
gcd1 = gcd (gcd1, LLE_DENOMINATOR (target_expr));
@ -967,9 +928,9 @@ lambda_compute_target_space (lambda_loopnest auxillary_nest,
}
/* Find the gcd and divide by it here, instead of at the
tree level. */
gcd1 = gcd_vector (LLE_COEFFICIENTS (target_expr), depth);
gcd2 = gcd_vector (LLE_INVARIANT_COEFFICIENTS (target_expr),
invariants);
gcd1 = lambda_vector_gcd (LLE_COEFFICIENTS (target_expr), depth);
gcd2 = lambda_vector_gcd (LLE_INVARIANT_COEFFICIENTS (target_expr),
invariants);
gcd1 = gcd (gcd1, gcd2);
gcd1 = gcd (gcd1, LLE_CONSTANT (target_expr));
gcd1 = gcd (gcd1, LLE_DENOMINATOR (target_expr));

View File

@ -1,5 +1,5 @@
/* Lambda matrix and vector interface.
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Daniel Berlin <dberlin@dberlin.org>
This file is part of GCC.
@ -380,6 +380,44 @@ print_lambda_vector (FILE * outfile, lambda_vector vector, int n)
fprintf (outfile, "\n");
}
/* Compute the greatest common divisor of two numbers using
Euclid's algorithm. */
static inline int
gcd (int a, int b)
{
int x, y, z;
x = abs (a);
y = abs (b);
while (x > 0)
{
z = y % x;
y = x;
x = z;
}
return y;
}
/* Compute the greatest common divisor of a VECTOR of SIZE numbers. */
static inline int
lambda_vector_gcd (lambda_vector vector, int size)
{
int i;
int gcd1 = 0;
if (size > 0)
{
gcd1 = vector[0];
for (i = 1; i < size; i++)
gcd1 = gcd (gcd1, vector[i]);
}
return gcd1;
}
/* Returns true when the vector V is lexicographically positive, in
other words, when the first nonzero element is positive. */

View File

@ -1,6 +1,6 @@
/* Chains of recurrences.
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Sebastian Pop <s.pop@laposte.net>
Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Sebastian Pop <pop@cri.ensmp.fr>
This file is part of GCC.
@ -1232,3 +1232,32 @@ chrec_type (tree chrec)
return TREE_TYPE (chrec);
}
/* Returns true when CHREC0 == CHREC1. */
bool
eq_evolutions_p (tree chrec0,
tree chrec1)
{
if (chrec0 == NULL_TREE
|| chrec1 == NULL_TREE
|| TREE_CODE (chrec0) != TREE_CODE (chrec1))
return false;
if (chrec0 == chrec1)
return true;
switch (TREE_CODE (chrec0))
{
case INTEGER_CST:
return integer_zerop (fold (build2 (MINUS_EXPR, TREE_TYPE (chrec0),
chrec0, chrec1)));
case POLYNOMIAL_CHREC:
return (CHREC_VARIABLE (chrec0) == CHREC_VARIABLE (chrec1)
&& eq_evolutions_p (CHREC_LEFT (chrec0), CHREC_LEFT (chrec1))
&& eq_evolutions_p (CHREC_RIGHT (chrec0), CHREC_RIGHT (chrec1)));
default:
return false;
}
}

View File

@ -1,6 +1,6 @@
/* Chains of recurrences.
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Sebastian Pop <s.pop@laposte.net>
Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Sebastian Pop <pop@cri.ensmp.fr>
This file is part of GCC.
@ -82,6 +82,7 @@ extern tree reset_evolution_in_loop (unsigned, tree, tree);
extern tree chrec_merge (tree, tree);
/* Observers. */
extern bool eq_evolutions_p (tree, tree);
extern bool is_multivariate_chrec (tree);
extern bool chrec_is_positive (tree, bool *);
extern bool chrec_contains_symbols (tree);

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/* Data references and dependences detectors.
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Sebastian Pop <s.pop@laposte.net>
Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Sebastian Pop <pop@cri.ensmp.fr>
This file is part of GCC.
@ -228,6 +228,10 @@ struct data_dependence_relation
VEC(lambda_vector,heap) *dist_vects;
};
typedef struct data_dependence_relation *ddr_p;
DEF_VEC_P(ddr_p);
DEF_VEC_ALLOC_P(ddr_p,heap);
#define DDR_A(DDR) DDR->a
#define DDR_B(DDR) DDR->b
#define DDR_AFFINE_P(DDR) DDR->affine_p
@ -253,13 +257,9 @@ struct data_dependence_relation
extern tree find_data_references_in_loop (struct loop *, varray_type *);
extern struct data_dependence_relation *initialize_data_dependence_relation
(struct data_reference *, struct data_reference *);
extern void compute_affine_dependence (struct data_dependence_relation *);
extern void analyze_all_data_dependences (struct loops *);
extern void compute_data_dependences_for_loop (struct loop *, bool,
varray_type *, varray_type *);
extern void print_direction_vector (FILE *, lambda_vector, int);
extern void dump_subscript (FILE *, struct subscript *);
extern void dump_ddrs (FILE *, varray_type);
extern void dump_dist_dir_vectors (FILE *, varray_type);
@ -273,11 +273,9 @@ extern void dump_data_dependence_direction (FILE *,
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 compute_subscript_distance (struct data_dependence_relation *);
extern struct data_reference *analyze_array (tree, tree, bool);
extern void estimate_iters_using_array (tree, tree);
#endif /* GCC_TREE_DATA_REF_H */