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>
* rtl.def (Copyright): Update date.
......
......@@ -2046,7 +2046,7 @@ tree-browser.o : tree-browser.c tree-browser.def $(CONFIG_H) $(SYSTEM_H) \
$(TM_H) coretypes.h
tree-chrec.o: tree-chrec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(GGC_H) $(TREE_H) $(REAL_H) $(SCEV_H) tree-pass.h $(PARAMS_H) \
$(DIAGNOSTIC_H) $(VARRAY_H) $(CFGLOOP_H) $(TREE_FLOW_H)
$(DIAGNOSTIC_H) $(CFGLOOP_H) $(TREE_FLOW_H)
tree-scalar-evolution.o: tree-scalar-evolution.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(REAL_H) $(RTL_H) \
$(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) \
......@@ -2078,7 +2078,7 @@ tree-loop-linear.o: tree-loop-linear.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(GGC_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
tree-pass.h $(TREE_DATA_REF_H) $(SCEV_H) $(EXPR_H) $(LAMBDA_H) \
$(TARGET_H) tree-chrec.h $(VARRAY_H)
$(TARGET_H) tree-chrec.h
tree-stdarg.o: tree-stdarg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(FUNCTION_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) tree-pass.h \
tree-stdarg.h $(TARGET_H) langhooks.h
......@@ -2582,9 +2582,9 @@ ifcvt.o : ifcvt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TARGET_H) $(BASIC_BLOCK_H) $(EXPR_H) output.h except.h $(TM_P_H) \
$(REAL_H) $(OPTABS_H) $(CFGLOOP_H) hard-reg-set.h timevar.h tree-pass.h
lambda-mat.o : lambda-mat.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \
$(TM_H) coretypes.h $(TREE_H) $(VARRAY_H)
$(TM_H) coretypes.h $(TREE_H)
lambda-trans.o: lambda-trans.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \
$(TM_H) coretypes.h $(TARGET_H) $(TREE_H) $(VARRAY_H)
$(TM_H) coretypes.h $(TARGET_H) $(TREE_H)
lambda-code.o: lambda-code.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \
$(TM_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
......
......@@ -2578,7 +2578,7 @@ perfect_nestify (struct loops *loops,
bool
lambda_transform_legal_p (lambda_trans_matrix trans,
int nb_loops,
varray_type dependence_relations)
VEC (ddr_p, heap) *dependence_relations)
{
unsigned int i, j;
lambda_vector distres;
......@@ -2589,8 +2589,7 @@ lambda_transform_legal_p (lambda_trans_matrix trans,
/* When there is an unknown relation in the dependence_relations, we
know that it is no worth looking at this loop nest: give up. */
ddr = (struct data_dependence_relation *)
VARRAY_GENERIC_PTR (dependence_relations, 0);
ddr = VEC_index (ddr_p, dependence_relations, 0);
if (ddr == NULL)
return true;
if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
......@@ -2599,11 +2598,8 @@ lambda_transform_legal_p (lambda_trans_matrix trans,
distres = lambda_vector_new (nb_loops);
/* For each distance vector in the dependence graph. */
for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_relations); i++)
for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++)
{
ddr = (struct data_dependence_relation *)
VARRAY_GENERIC_PTR (dependence_relations, i);
/* Don't care about relations for which we know that there is no
dependence, nor about read-read (aka. output-dependences):
these data accesses can happen in any order. */
......
......@@ -23,7 +23,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "coretypes.h"
#include "tm.h"
#include "ggc.h"
#include "varray.h"
#include "tree.h"
#include "lambda.h"
......
......@@ -26,7 +26,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "ggc.h"
#include "tree.h"
#include "target.h"
#include "varray.h"
#include "lambda.h"
/* Allocate a new transformation matrix. */
......
......@@ -143,7 +143,6 @@ lambda_loopnest lambda_loopnest_transform (lambda_loopnest, lambda_trans_matrix)
struct loop;
struct loops;
bool perfect_nest_p (struct loop *);
bool lambda_transform_legal_p (lambda_trans_matrix, int, varray_type);
void print_lambda_loopnest (FILE *, lambda_loopnest, char);
#define lambda_loop_new() (lambda_loop) ggc_alloc_cleared (sizeof (struct lambda_loop_s))
......
......@@ -32,7 +32,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "tree.h"
#include "real.h"
#include "diagnostic.h"
#include "varray.h"
#include "cfgloop.h"
#include "tree-flow.h"
#include "tree-chrec.h"
......
......@@ -107,6 +107,10 @@ struct data_reference
enum data_ref_type type;
};
typedef struct data_reference *data_reference_p;
DEF_VEC_P(data_reference_p);
DEF_VEC_ALLOC_P (data_reference_p, heap);
#define DR_STMT(DR) (DR)->stmt
#define DR_REF(DR) (DR)->ref
#define DR_BASE_OBJECT(DR) (DR)->object_info.base_object
......@@ -181,6 +185,10 @@ struct subscript
tree distance;
};
typedef struct subscript *subscript_p;
DEF_VEC_P(subscript_p);
DEF_VEC_ALLOC_P (subscript_p, heap);
#define SUB_CONFLICTS_IN_A(SUB) SUB->conflicting_iterations_in_a
#define SUB_CONFLICTS_IN_B(SUB) SUB->conflicting_iterations_in_b
#define SUB_LAST_CONFLICT(SUB) SUB->last_conflict
......@@ -219,16 +227,16 @@ struct data_dependence_relation
/* For each subscript in the dependence test, there is an element in
this array. This is the attribute that labels the edge A->B of
the data_dependence_relation. */
varray_type subscripts;
VEC (subscript_p, heap) *subscripts;
/* The analyzed loop nest. */
VEC (loop_p, heap) *loop_nest;
/* The classic direction vector. */
VEC(lambda_vector,heap) *dir_vects;
VEC (lambda_vector, heap) *dir_vects;
/* The classic distance vector. */
VEC(lambda_vector,heap) *dist_vects;
VEC (lambda_vector, heap) *dist_vects;
};
typedef struct data_dependence_relation *ddr_p;
......@@ -240,10 +248,8 @@ DEF_VEC_ALLOC_P(ddr_p,heap);
#define DDR_AFFINE_P(DDR) DDR->affine_p
#define DDR_ARE_DEPENDENT(DDR) DDR->are_dependent
#define DDR_SUBSCRIPTS(DDR) DDR->subscripts
#define DDR_SUBSCRIPTS_VECTOR_INIT(DDR, N) \
VARRAY_GENERIC_PTR_INIT (DDR_SUBSCRIPTS (DDR), N, "subscripts_vector");
#define DDR_SUBSCRIPT(DDR, I) VARRAY_GENERIC_PTR (DDR_SUBSCRIPTS (DDR), I)
#define DDR_NUM_SUBSCRIPTS(DDR) VARRAY_ACTIVE_SIZE (DDR_SUBSCRIPTS (DDR))
#define DDR_SUBSCRIPT(DDR, I) VEC_index (subscript_p, DDR_SUBSCRIPTS (DDR), I)
#define DDR_NUM_SUBSCRIPTS(DDR) VEC_length (subscript_p, DDR_SUBSCRIPTS (DDR))
#define DDR_LOOP_NEST(DDR) DDR->loop_nest
/* The size of the direction/distance vectors: the number of loops in
......@@ -263,29 +269,32 @@ DEF_VEC_ALLOC_P(ddr_p,heap);
extern tree find_data_references_in_loop (struct loop *, varray_type *);
extern tree find_data_references_in_loop (struct loop *,
VEC (data_reference_p, heap) *);
extern void compute_data_dependences_for_loop (struct loop *, bool,
varray_type *, varray_type *);
VEC (data_reference_p, heap) *,
VEC (ddr_p, heap) *);
extern void print_direction_vector (FILE *, lambda_vector, int);
extern void print_dir_vectors (FILE *, VEC (lambda_vector, heap) *, int);
extern void print_dist_vectors (FILE *, VEC (lambda_vector, heap) *, int);
extern void dump_subscript (FILE *, struct subscript *);
extern void dump_ddrs (FILE *, varray_type);
extern void dump_dist_dir_vectors (FILE *, varray_type);
extern void dump_ddrs (FILE *, VEC (ddr_p, heap) *);
extern void dump_dist_dir_vectors (FILE *, VEC (ddr_p, heap) *);
extern void dump_data_reference (FILE *, struct data_reference *);
extern void dump_data_references (FILE *, varray_type);
extern void dump_data_references (FILE *, VEC (data_reference_p, heap) *);
extern void debug_data_dependence_relation (struct data_dependence_relation *);
extern void dump_data_dependence_relation (FILE *,
struct data_dependence_relation *);
extern void dump_data_dependence_relations (FILE *, varray_type);
extern void dump_data_dependence_relations (FILE *, VEC (ddr_p, heap) *);
extern void dump_data_dependence_direction (FILE *,
enum data_dependence_direction);
extern void free_dependence_relation (struct data_dependence_relation *);
extern void free_dependence_relations (varray_type);
extern void free_data_refs (varray_type);
extern void free_dependence_relations (VEC (ddr_p, heap) *);
extern void free_data_refs (VEC (data_reference_p, heap) *);
extern struct data_reference *analyze_array (tree, tree, bool);
extern void estimate_iters_using_array (tree, tree);
/* Return the index of the variable VAR in the LOOP_NEST array. */
static inline int
......@@ -302,6 +311,7 @@ index_in_loop_nest (int var, VEC (loop_p, heap) *loop_nest)
return var_index;
}
/* In lambda-code.c */
bool lambda_transform_legal_p (lambda_trans_matrix, int, VEC (ddr_p, heap) *);
#endif /* GCC_TREE_DATA_REF_H */
......@@ -41,7 +41,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "tree-data-ref.h"
#include "tree-scalar-evolution.h"
#include "tree-pass.h"
#include "varray.h"
#include "lambda.h"
/* Linear loop transforms include any composition of interchange,
......@@ -90,8 +89,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
*/
static void
gather_interchange_stats (varray_type dependence_relations,
varray_type datarefs,
gather_interchange_stats (VEC (ddr_p, heap) *dependence_relations,
VEC (data_reference_p, heap) *datarefs,
struct loop *loop,
struct loop *first_loop,
unsigned int *dependence_steps,
......@@ -99,17 +98,15 @@ gather_interchange_stats (varray_type dependence_relations,
unsigned int *access_strides)
{
unsigned int i, j;
struct data_dependence_relation *ddr;
struct data_reference *dr;
*dependence_steps = 0;
*nb_deps_not_carried_by_loop = 0;
*access_strides = 0;
for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_relations); i++)
for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++)
{
struct data_dependence_relation *ddr =
(struct data_dependence_relation *)
VARRAY_GENERIC_PTR (dependence_relations, i);
/* If we don't know anything about this dependence, or the distance
vector is NULL, or there is no dependence, then there is no reuse of
data. */
......@@ -134,10 +131,9 @@ gather_interchange_stats (varray_type dependence_relations,
}
/* Compute the access strides. */
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
unsigned int it;
struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i);
tree stmt = DR_STMT (dr);
struct loop *stmt_loop = loop_containing_stmt (stmt);
struct loop *inner_loop = first_loop->inner;
......@@ -171,8 +167,8 @@ gather_interchange_stats (varray_type dependence_relations,
static lambda_trans_matrix
try_interchange_loops (lambda_trans_matrix trans,
unsigned int depth,
varray_type dependence_relations,
varray_type datarefs,
VEC (ddr_p, heap) *dependence_relations,
VEC (data_reference_p, heap) *datarefs,
struct loop *first_loop)
{
struct loop *loop_i;
......@@ -184,8 +180,7 @@ try_interchange_loops (lambda_trans_matrix trans,
/* When there is an unknown relation in the dependence_relations, we
know that it is no worth looking at this loop nest: give up. */
ddr = (struct data_dependence_relation *)
VARRAY_GENERIC_PTR (dependence_relations, 0);
ddr = VEC_index (ddr_p, dependence_relations, 0);
if (ddr == NULL || DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
return trans;
......@@ -250,8 +245,8 @@ linear_transform_loops (struct loops *loops)
for (i = 1; i < loops->num; i++)
{
unsigned int depth = 0;
varray_type datarefs;
varray_type dependence_relations;
VEC (ddr_p, heap) *dependence_relations;
VEC (data_reference_p, heap) *datarefs;
struct loop *loop_nest = loops->parray[i];
struct loop *temp;
lambda_loopnest before, after;
......@@ -292,31 +287,17 @@ linear_transform_loops (struct loops *loops)
/* Analyze data references and dependence relations using scev. */
VARRAY_GENERIC_PTR_INIT (datarefs, 10, "datarefs");
VARRAY_GENERIC_PTR_INIT (dependence_relations, 10,
"dependence_relations");
compute_data_dependences_for_loop (loop_nest, true,
&datarefs, &dependence_relations);
datarefs = VEC_alloc (data_reference_p, heap, 10);
dependence_relations = VEC_alloc (ddr_p, heap, 10 * 10);
compute_data_dependences_for_loop (loop_nest, true, datarefs,
dependence_relations);
if (dump_file && (dump_flags & TDF_DETAILS))
{
unsigned int j;
for (j = 0; j < VARRAY_ACTIVE_SIZE (dependence_relations); j++)
{
struct data_dependence_relation *ddr =
(struct data_dependence_relation *)
VARRAY_GENERIC_PTR (dependence_relations, j);
dump_ddrs (dump_file, dependence_relations);
if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE)
dump_data_dependence_relation (dump_file, ddr);
}
fprintf (dump_file, "\n\n");
}
/* Build the transformation matrix. */
trans = lambda_trans_matrix_new (depth, depth);
lambda_matrix_id (LTM_MATRIX (trans), depth);
trans = try_interchange_loops (trans, depth, dependence_relations,
datarefs, loop_nest);
......@@ -334,8 +315,10 @@ linear_transform_loops (struct loops *loops)
fprintf (dump_file, "Can't transform loop, transform is illegal:\n");
continue;
}
if (!perfect_nest_p (loop_nest))
need_perfect_nest = true;
before = gcc_loopnest_to_lambda_loopnest (loops,
loop_nest, &oldivs,
&invariants,
......@@ -350,18 +333,23 @@ linear_transform_loops (struct loops *loops)
}
after = lambda_loopnest_transform (before, trans);
if (dump_file)
{
fprintf (dump_file, "After:\n");
print_lambda_loopnest (dump_file, after, 'u');
}
lambda_loopnest_to_gcc_loopnest (loop_nest, oldivs, invariants,
after, trans);
if (dump_file)
fprintf (dump_file, "Successfully transformed loop.\n");
free_dependence_relations (dependence_relations);
free_data_refs (datarefs);
}
VEC_free (tree, heap, oldivs);
VEC_free (tree, heap, invariants);
scev_reset ();
......
......@@ -679,18 +679,15 @@ static bool
vect_analyze_data_ref_dependences (loop_vec_info loop_vinfo)
{
unsigned int i;
varray_type ddrs = LOOP_VINFO_DDRS (loop_vinfo);
VEC (ddr_p, heap) *ddrs = LOOP_VINFO_DDRS (loop_vinfo);
struct data_dependence_relation *ddr;
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "=== vect_analyze_dependences ===");
for (i = 0; i < VARRAY_ACTIVE_SIZE (ddrs); i++)
{
struct data_dependence_relation *ddr = VARRAY_GENERIC_PTR (ddrs, i);
if (vect_analyze_data_ref_dependence (ddr, loop_vinfo))
return false;
}
for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++)
if (vect_analyze_data_ref_dependence (ddr, loop_vinfo))
return false;
return true;
}
......@@ -812,15 +809,13 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
static bool
vect_compute_data_refs_alignment (loop_vec_info loop_vinfo)
{
varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
VEC (data_reference_p, heap) *datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
struct data_reference *dr;
unsigned int i;
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
{
struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i);
if (!vect_compute_data_ref_alignment (dr))
return false;
}
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
if (!vect_compute_data_ref_alignment (dr))
return false;
return true;
}
......@@ -884,13 +879,13 @@ vect_update_misalignment_for_peel (struct data_reference *dr,
static bool
vect_verify_datarefs_alignment (loop_vec_info loop_vinfo)
{
varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
VEC (data_reference_p, heap) *datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
struct data_reference *dr;
enum dr_alignment_support supportable_dr_alignment;
unsigned int i;
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i);
supportable_dr_alignment = vect_supportable_dr_alignment (dr);
if (!supportable_dr_alignment)
{
......@@ -1007,7 +1002,7 @@ vect_verify_datarefs_alignment (loop_vec_info loop_vinfo)
static bool
vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
{
varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
VEC (data_reference_p, heap) *datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
enum dr_alignment_support supportable_dr_alignment;
struct data_reference *dr0 = NULL;
struct data_reference *dr;
......@@ -1055,16 +1050,13 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
TODO: Use a cost model. */
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
{
dr = VARRAY_GENERIC_PTR (datarefs, i);
if (!DR_IS_READ (dr) && !aligned_access_p (dr))
{
dr0 = dr;
do_peeling = true;
break;
}
}
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
if (!DR_IS_READ (dr) && !aligned_access_p (dr))
{
dr0 = dr;
do_peeling = true;
break;
}
/* Often peeling for alignment will require peeling for loop-bound, which in
turn requires that we know how to adjust the loop ivs after the loop. */
......@@ -1088,13 +1080,13 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
}
/* Ensure that all data refs can be vectorized after the peel. */
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
int save_misalignment;
dr = VARRAY_GENERIC_PTR (datarefs, i);
if (dr == dr0)
continue;
save_misalignment = DR_MISALIGNMENT (dr);
vect_update_misalignment_for_peel (dr, dr0, npeel);
supportable_dr_alignment = vect_supportable_dr_alignment (dr);
......@@ -1116,13 +1108,9 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
by the peeling factor times the element size of DR_i (MOD the
vectorization factor times the size). Otherwise, the
misalignment of DR_i must be set to unknown. */
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
{
dr = VARRAY_GENERIC_PTR (datarefs, i);
if (dr == dr0)
continue;
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
if (dr != dr0)
vect_update_misalignment_for_peel (dr, dr0, npeel);
}
LOOP_VINFO_UNALIGNED_DR (loop_vinfo) = dr0;
LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo) = DR_MISALIGNMENT (dr0);
......@@ -1154,10 +1142,8 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
if (do_versioning)
{
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
dr = VARRAY_GENERIC_PTR (datarefs, i);
if (aligned_access_p (dr))
continue;
......@@ -1303,21 +1289,19 @@ static bool
vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo)
{
unsigned int i;
varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
VEC (data_reference_p, heap) *datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
struct data_reference *dr;
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "=== vect_analyze_data_ref_accesses ===");
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
{
struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i);
if (!vect_analyze_data_ref_access (dr))
{
if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
fprintf (vect_dump, "not vectorized: complicated access pattern.");
return false;
}
}
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
if (!vect_analyze_data_ref_access (dr))
{
if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
fprintf (vect_dump, "not vectorized: complicated access pattern.");
return false;
}
return true;
}
......@@ -1342,22 +1326,23 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
unsigned int i;
varray_type datarefs;
VEC (data_reference_p, heap) *datarefs;
struct data_reference *dr;
tree scalar_type;
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "=== vect_analyze_data_refs ===");
compute_data_dependences_for_loop (loop, false,
&(LOOP_VINFO_DATAREFS (loop_vinfo)),
&(LOOP_VINFO_DDRS (loop_vinfo)));
LOOP_VINFO_DATAREFS (loop_vinfo),
LOOP_VINFO_DDRS (loop_vinfo));
/* Go through the data-refs, check that the analysis succeeded. Update pointer
from stmt_vec_info struct to DR and vectype. */
datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i);
tree stmt;
stmt_vec_info stmt_info;
......
......@@ -2769,16 +2769,14 @@ static void
vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters)
{
unsigned int i;
varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
VEC (data_reference_p, heap) *datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
struct data_reference *dr;
if (vect_dump && (dump_flags & TDF_DETAILS))
fprintf (vect_dump, "=== vect_update_inits_of_dr ===");
for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
{
struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i);
vect_update_init_of_dr (dr, niters);
}
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
vect_update_init_of_dr (dr, niters);
}
......
......@@ -1420,8 +1420,8 @@ new_loop_vec_info (struct loop *loop)
LOOP_VINFO_VECTORIZABLE_P (res) = 0;
LOOP_PEELING_FOR_ALIGNMENT (res) = 0;
LOOP_VINFO_VECT_FACTOR (res) = 0;
VARRAY_GENERIC_PTR_INIT (LOOP_VINFO_DATAREFS (res), 20, "loop_datarefs");
VARRAY_GENERIC_PTR_INIT (LOOP_VINFO_DDRS (res), 20, "loop_ddrs");
LOOP_VINFO_DATAREFS (res) = VEC_alloc (data_reference_p, heap, 10);
LOOP_VINFO_DDRS (res) = VEC_alloc (ddr_p, heap, 10 * 10);
LOOP_VINFO_UNALIGNED_DR (res) = NULL;
LOOP_VINFO_MAY_MISALIGN_STMTS (res)
= VEC_alloc (tree, heap, PARAM_VALUE (PARAM_VECT_MAX_VERSION_CHECKS));
......@@ -1483,8 +1483,8 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo)
}
free (LOOP_VINFO_BBS (loop_vinfo));
varray_clear (LOOP_VINFO_DATAREFS (loop_vinfo));
varray_clear (LOOP_VINFO_DDRS (loop_vinfo));
free_data_refs (LOOP_VINFO_DATAREFS (loop_vinfo));
free_dependence_relations (LOOP_VINFO_DDRS (loop_vinfo));
VEC_free (tree, heap, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo));
free (loop_vinfo);
......
......@@ -122,10 +122,10 @@ typedef struct _loop_vec_info {
int ptr_mask;
/* All data references in the loop. */
varray_type datarefs;
VEC (data_reference_p, heap) *datarefs;
/* All data dependences in the loop. */
varray_type ddrs;
VEC (ddr_p, heap) *ddrs;
/* Statements in the loop that have data references that are candidates for a
runtime (loop versioning) misalignment check. */
......
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