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"
......
...@@ -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