This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] use VEC instead of varray in data dependence analysis
- From: "Sebastian Pop" <sebpop at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 28 Mar 2006 06:20:58 +0200
- Subject: [patch] use VEC instead of varray in data dependence analysis
Hi,
This patch is a quite automatic change to clean all the remaining uses
of varray in the data dependence analysis. Bootstrapped and tested on
amd64-linux with no new regressions. Committed to trunk as rev112437.
Sebastian
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 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.
Index: tree-loop-linear.c
===================================================================
*** tree-loop-linear.c (revision 112436)
--- tree-loop-linear.c (working copy)
*************** Software Foundation, 51 Franklin Street,
*** 41,47 ****
#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,
--- 41,46 ----
*************** Software Foundation, 51 Franklin Street,
*** 90,97 ****
*/
static void
! gather_interchange_stats (varray_type dependence_relations,
! varray_type datarefs,
struct loop *loop,
struct loop *first_loop,
unsigned int *dependence_steps,
--- 89,96 ----
*/
static void
! 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,
*************** gather_interchange_stats (varray_type de
*** 99,115 ****
unsigned int *access_strides)
{
unsigned int i, j;
*dependence_steps = 0;
*nb_deps_not_carried_by_loop = 0;
*access_strides = 0;
! for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_relations); 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. */
--- 98,112 ----
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; VEC_iterate (ddr_p, dependence_relations, i, ddr); 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. */
*************** gather_interchange_stats (varray_type de
*** 134,143 ****
}
/* Compute the access strides. */
! for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); 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;
--- 131,139 ----
}
/* Compute the access strides. */
! for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
unsigned int it;
tree stmt = DR_STMT (dr);
struct loop *stmt_loop = loop_containing_stmt (stmt);
struct loop *inner_loop = first_loop->inner;
*************** gather_interchange_stats (varray_type de
*** 171,178 ****
static lambda_trans_matrix
try_interchange_loops (lambda_trans_matrix trans,
unsigned int depth,
! varray_type dependence_relations,
! varray_type datarefs,
struct loop *first_loop)
{
struct loop *loop_i;
--- 167,174 ----
static lambda_trans_matrix
try_interchange_loops (lambda_trans_matrix trans,
unsigned int depth,
! VEC (ddr_p, heap) *dependence_relations,
! VEC (data_reference_p, heap) *datarefs,
struct loop *first_loop)
{
struct loop *loop_i;
*************** try_interchange_loops (lambda_trans_matr
*** 184,191 ****
/* 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);
if (ddr == NULL || DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
return trans;
--- 180,186 ----
/* 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 = VEC_index (ddr_p, dependence_relations, 0);
if (ddr == NULL || DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
return trans;
*************** linear_transform_loops (struct loops *lo
*** 250,257 ****
for (i = 1; i < loops->num; i++)
{
unsigned int depth = 0;
! varray_type datarefs;
! varray_type dependence_relations;
struct loop *loop_nest = loops->parray[i];
struct loop *temp;
lambda_loopnest before, after;
--- 245,252 ----
for (i = 1; i < loops->num; i++)
{
unsigned int depth = 0;
! 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;
*************** linear_transform_loops (struct loops *lo
*** 292,322 ****
/* 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);
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);
- 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);
--- 287,303 ----
/* Analyze data references and dependence relations using scev. */
! 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))
! dump_ddrs (dump_file, dependence_relations);
/* 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);
*************** linear_transform_loops (struct loops *lo
*** 334,341 ****
--- 315,324 ----
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,
*************** linear_transform_loops (struct loops *lo
*** 350,367 ****
--- 333,355 ----
}
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 ();
Index: lambda-mat.c
===================================================================
*** lambda-mat.c (revision 112436)
--- lambda-mat.c (working copy)
*************** Software Foundation, 51 Franklin Street,
*** 23,29 ****
#include "coretypes.h"
#include "tm.h"
#include "ggc.h"
- #include "varray.h"
#include "tree.h"
#include "lambda.h"
--- 23,28 ----
Index: tree-chrec.c
===================================================================
*** tree-chrec.c (revision 112436)
--- tree-chrec.c (working copy)
*************** Software Foundation, 51 Franklin Street,
*** 32,38 ****
#include "tree.h"
#include "real.h"
#include "diagnostic.h"
- #include "varray.h"
#include "cfgloop.h"
#include "tree-flow.h"
#include "tree-chrec.h"
--- 32,37 ----
Index: lambda-trans.c
===================================================================
*** lambda-trans.c (revision 112436)
--- lambda-trans.c (working copy)
*************** Software Foundation, 51 Franklin Street,
*** 26,32 ****
#include "ggc.h"
#include "tree.h"
#include "target.h"
- #include "varray.h"
#include "lambda.h"
/* Allocate a new transformation matrix. */
--- 26,31 ----
Index: tree-vectorizer.c
===================================================================
*** tree-vectorizer.c (revision 112436)
--- tree-vectorizer.c (working copy)
*************** new_loop_vec_info (struct loop *loop)
*** 1420,1427 ****
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_UNALIGNED_DR (res) = NULL;
LOOP_VINFO_MAY_MISALIGN_STMTS (res)
= VEC_alloc (tree, heap, PARAM_VALUE (PARAM_VECT_MAX_VERSION_CHECKS));
--- 1420,1427 ----
LOOP_VINFO_VECTORIZABLE_P (res) = 0;
LOOP_PEELING_FOR_ALIGNMENT (res) = 0;
LOOP_VINFO_VECT_FACTOR (res) = 0;
! 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));
*************** destroy_loop_vec_info (loop_vec_info loo
*** 1483,1490 ****
}
free (LOOP_VINFO_BBS (loop_vinfo));
! varray_clear (LOOP_VINFO_DATAREFS (loop_vinfo));
! varray_clear (LOOP_VINFO_DDRS (loop_vinfo));
VEC_free (tree, heap, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo));
free (loop_vinfo);
--- 1483,1490 ----
}
free (LOOP_VINFO_BBS (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);
Index: tree-vectorizer.h
===================================================================
*** tree-vectorizer.h (revision 112436)
--- tree-vectorizer.h (working copy)
*************** typedef struct _loop_vec_info {
*** 122,131 ****
int ptr_mask;
/* All data references in the loop. */
! varray_type datarefs;
/* All data dependences in the loop. */
! varray_type ddrs;
/* Statements in the loop that have data references that are candidates for a
runtime (loop versioning) misalignment check. */
--- 122,131 ----
int ptr_mask;
/* All data references in the loop. */
! VEC (data_reference_p, heap) *datarefs;
/* All data dependences in the loop. */
! VEC (ddr_p, heap) *ddrs;
/* Statements in the loop that have data references that are candidates for a
runtime (loop versioning) misalignment check. */
Index: tree-data-ref.c
===================================================================
*** tree-data-ref.c (revision 112436)
--- tree-data-ref.c (working copy)
*************** int_divides_p (int a, int b)
*** 526,550 ****
/* Dump into FILE all the data references from DATAREFS. */
void
! dump_data_references (FILE *file,
! varray_type datarefs)
{
unsigned int i;
!
! for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
! dump_data_reference (file, VARRAY_GENERIC_PTR (datarefs, i));
}
! /* Dump into FILE all the dependence relations from DDR. */
void
dump_data_dependence_relations (FILE *file,
! varray_type ddr)
{
unsigned int i;
!
! for (i = 0; i < VARRAY_ACTIVE_SIZE (ddr); i++)
! dump_data_dependence_relation (file, VARRAY_GENERIC_PTR (ddr, i));
}
/* Dump function for a DATA_REFERENCE structure. */
--- 526,551 ----
/* Dump into FILE all the data references from DATAREFS. */
void
! dump_data_references (FILE *file, VEC (data_reference_p, heap) *datarefs)
{
unsigned int i;
! struct data_reference *dr;
!
! 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 DDRS. */
void
dump_data_dependence_relations (FILE *file,
! VEC (ddr_p, heap) *ddrs)
{
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);
}
/* Dump function for a DATA_REFERENCE structure. */
*************** dump_data_dependence_direction (FILE *fi
*** 790,841 ****
considered nest. */
void
! dump_dist_dir_vectors (FILE *file, varray_type ddrs)
{
unsigned int i, j;
! for (i = 0; i < VARRAY_ACTIVE_SIZE (ddrs); i++)
! {
! struct data_dependence_relation *ddr =
! (struct data_dependence_relation *)
! VARRAY_GENERIC_PTR (ddrs, i);
! if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE
! && DDR_AFFINE_P (ddr))
! {
! for (j = 0; j < DDR_NUM_DIST_VECTS (ddr); j++)
! {
! fprintf (file, "DISTANCE_V (");
! print_lambda_vector (file, DDR_DIST_VECT (ddr, j),
! 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");
}
/* Dumps the data dependence relations DDRS in FILE. */
void
! dump_ddrs (FILE *file, varray_type ddrs)
{
unsigned int i;
- 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");
}
--- 791,834 ----
considered nest. */
void
! dump_dist_dir_vectors (FILE *file, VEC (ddr_p, heap) *ddrs)
{
unsigned int i, j;
+ struct data_dependence_relation *ddr;
+ lambda_vector v;
! for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++)
! if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE && DDR_AFFINE_P (ddr))
! {
! for (j = 0; VEC_iterate (lambda_vector, DDR_DIST_VECTS (ddr), j, v); j++)
! {
! fprintf (file, "DISTANCE_V (");
! print_lambda_vector (file, v, DDR_NB_LOOPS (ddr));
! fprintf (file, ")\n");
! }
!
! for (j = 0; VEC_iterate (lambda_vector, DDR_DIR_VECTS (ddr), j, v); j++)
! {
! fprintf (file, "DIRECTION_V (");
! print_direction_vector (file, v, DDR_NB_LOOPS (ddr));
! fprintf (file, ")\n");
! }
! }
fprintf (file, "\n\n");
}
/* Dumps the data dependence relations DDRS in FILE. */
void
! dump_ddrs (FILE *file, VEC (ddr_p, heap) *ddrs)
{
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);
fprintf (file, "\n\n");
}
*************** initialize_data_dependence_relation (str
*** 2135,2141 ****
DDR_AFFINE_P (res) = true;
DDR_ARE_DEPENDENT (res) = NULL_TREE;
! DDR_SUBSCRIPTS_VECTOR_INIT (res, DR_NUM_DIMENSIONS (a));
DDR_LOOP_NEST (res) = loop_nest;
DDR_DIR_VECTS (res) = NULL;
DDR_DIST_VECTS (res) = NULL;
--- 2128,2134 ----
DDR_AFFINE_P (res) = true;
DDR_ARE_DEPENDENT (res) = NULL_TREE;
! DDR_SUBSCRIPTS (res) = VEC_alloc (subscript_p, heap, DR_NUM_DIMENSIONS (a));
DDR_LOOP_NEST (res) = loop_nest;
DDR_DIR_VECTS (res) = NULL;
DDR_DIST_VECTS (res) = NULL;
*************** initialize_data_dependence_relation (str
*** 2149,2157 ****
SUB_CONFLICTS_IN_B (subscript) = chrec_dont_know;
SUB_LAST_CONFLICT (subscript) = chrec_dont_know;
SUB_DISTANCE (subscript) = chrec_dont_know;
! VARRAY_PUSH_GENERIC_PTR (DDR_SUBSCRIPTS (res), subscript);
}
!
return res;
}
--- 2142,2150 ----
SUB_CONFLICTS_IN_B (subscript) = chrec_dont_know;
SUB_LAST_CONFLICT (subscript) = chrec_dont_know;
SUB_DISTANCE (subscript) = chrec_dont_know;
! VEC_safe_push (subscript_p, heap, DDR_SUBSCRIPTS (res), subscript);
}
!
return res;
}
*************** finalize_ddr_dependent (struct data_depe
*** 2170,2176 ****
}
DDR_ARE_DEPENDENT (ddr) = chrec;
! varray_clear (DDR_SUBSCRIPTS (ddr));
}
/* The dependence relation DDR cannot be represented by a distance
--- 2163,2169 ----
}
DDR_ARE_DEPENDENT (ddr) = chrec;
! VEC_free (subscript_p, heap, DDR_SUBSCRIPTS (ddr));
}
/* The dependence relation DDR cannot be represented by a distance
*************** subscript_dependence_tester_1 (struct da
*** 3776,3792 ****
{
unsigned int i;
tree last_conflicts;
! for (i = 0; i < DDR_NUM_SUBSCRIPTS (ddr); i++)
{
tree overlaps_a, overlaps_b;
! struct subscript *subscript = DDR_SUBSCRIPT (ddr, i);
!
analyze_overlapping_iterations (DR_ACCESS_FN (dra, i),
DR_ACCESS_FN (drb, i),
&overlaps_a, &overlaps_b,
&last_conflicts);
!
if (chrec_contains_undetermined (overlaps_a)
|| chrec_contains_undetermined (overlaps_b))
{
--- 3769,3786 ----
{
unsigned int i;
tree last_conflicts;
+ struct subscript *subscript;
! for (i = 0; VEC_iterate (subscript_p, DDR_SUBSCRIPTS (ddr), i, subscript);
! i++)
{
tree overlaps_a, overlaps_b;
!
analyze_overlapping_iterations (DR_ACCESS_FN (dra, i),
DR_ACCESS_FN (drb, i),
&overlaps_a, &overlaps_b,
&last_conflicts);
!
if (chrec_contains_undetermined (overlaps_a)
|| chrec_contains_undetermined (overlaps_b))
{
*************** subscript_dependence_tester_1 (struct da
*** 3794,3800 ****
dependence_stats.num_dependence_undetermined++;
return false;
}
!
else if (overlaps_a == chrec_known
|| overlaps_b == chrec_known)
{
--- 3788,3794 ----
dependence_stats.num_dependence_undetermined++;
return false;
}
!
else if (overlaps_a == chrec_known
|| overlaps_b == chrec_known)
{
*************** subscript_dependence_tester_1 (struct da
*** 3802,3808 ****
dependence_stats.num_dependence_independent++;
return false;
}
!
else
{
SUB_CONFLICTS_IN_A (subscript) = overlaps_a;
--- 3796,3802 ----
dependence_stats.num_dependence_independent++;
return false;
}
!
else
{
SUB_CONFLICTS_IN_A (subscript) = overlaps_a;
*************** static void
*** 3916,3926 ****
compute_self_dependence (struct data_dependence_relation *ddr)
{
unsigned int i;
! for (i = 0; i < DDR_NUM_SUBSCRIPTS (ddr); i++)
{
- struct subscript *subscript = DDR_SUBSCRIPT (ddr, i);
-
/* The accessed index overlaps for each iteration. */
SUB_CONFLICTS_IN_A (subscript) = integer_zero_node;
SUB_CONFLICTS_IN_B (subscript) = integer_zero_node;
--- 3910,3920 ----
compute_self_dependence (struct data_dependence_relation *ddr)
{
unsigned int i;
+ struct subscript *subscript;
! for (i = 0; VEC_iterate (subscript_p, DDR_SUBSCRIPTS (ddr), i, subscript);
! i++)
{
/* The accessed index overlaps for each iteration. */
SUB_CONFLICTS_IN_A (subscript) = integer_zero_node;
SUB_CONFLICTS_IN_B (subscript) = integer_zero_node;
*************** compute_self_dependence (struct data_dep
*** 3934,3986 ****
/* Compute in DEPENDENCE_RELATIONS the data dependence graph for all
the data references in DATAREFS, in the LOOP_NEST. When
! COMPUTE_SELF_AND_READ_READ_DEPENDENCES is FALSE, don't compute
! read-read and self relations. */
static void
! compute_all_dependences (varray_type datarefs,
! VEC(ddr_p,heap) **dependence_relations,
VEC (loop_p, heap) *loop_nest,
! bool compute_self_and_read_read_dependences)
{
! unsigned int i, j, N = VARRAY_ACTIVE_SIZE (datarefs);
! /* Note that we specifically skip i == j because it's a self dependence, and
! use compute_self_dependence below. */
! for (i = 0; i < N; i++)
! for (j = i + 1; j < N; j++)
{
! struct data_reference *a, *b;
! struct data_dependence_relation *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
--- 3928,3962 ----
/* Compute in DEPENDENCE_RELATIONS the data dependence graph for all
the data references in DATAREFS, in the LOOP_NEST. When
! COMPUTE_SELF_AND_RR is FALSE, don't compute read-read and self
! relations. */
static void
! compute_all_dependences (VEC (data_reference_p, heap) *datarefs,
! VEC (ddr_p, heap) *dependence_relations,
VEC (loop_p, heap) *loop_nest,
! bool compute_self_and_rr)
{
! struct data_dependence_relation *ddr;
! struct data_reference *a, *b;
! unsigned int i, j;
! for (i = 0; VEC_iterate (data_reference_p, datarefs, i, a); i++)
! 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);
! }
! if (compute_self_and_rr)
! for (i = 0; VEC_iterate (data_reference_p, datarefs, i, a); i++)
{
! ddr = initialize_data_dependence_relation (a, a, 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
*************** compute_all_dependences (varray_type dat
*** 3991,3997 ****
arithmetic as if they were array accesses, etc. */
tree
! find_data_references_in_loop (struct loop *loop, varray_type *datarefs)
{
basic_block bb, *bbs;
unsigned int i;
--- 3967,3974 ----
arithmetic as if they were array accesses, etc. */
tree
! find_data_references_in_loop (struct loop *loop,
! VEC (data_reference_p, heap) *datarefs)
{
basic_block bb, *bbs;
unsigned int i;
*************** find_data_references_in_loop (struct loo
*** 4035,4041 ****
dr = create_data_ref (opnd0, stmt, false);
if (dr)
{
! VARRAY_PUSH_GENERIC_PTR (*datarefs, dr);
one_inserted = true;
}
}
--- 4012,4018 ----
dr = create_data_ref (opnd0, stmt, false);
if (dr)
{
! VEC_safe_push (data_reference_p, heap, datarefs, dr);
one_inserted = true;
}
}
*************** find_data_references_in_loop (struct loo
*** 4047,4053 ****
dr = create_data_ref (opnd1, stmt, true);
if (dr)
{
! VARRAY_PUSH_GENERIC_PTR (*datarefs, dr);
one_inserted = true;
}
}
--- 4024,4030 ----
dr = create_data_ref (opnd1, stmt, true);
if (dr)
{
! VEC_safe_push (data_reference_p, heap, datarefs, dr);
one_inserted = true;
}
}
*************** find_data_references_in_loop (struct loo
*** 4072,4078 ****
dr = create_data_ref (TREE_VALUE (args), stmt, true);
if (dr)
{
! VARRAY_PUSH_GENERIC_PTR (*datarefs, dr);
one_inserted = true;
}
}
--- 4049,4055 ----
dr = create_data_ref (TREE_VALUE (args), stmt, true);
if (dr)
{
! VEC_safe_push (data_reference_p, heap, datarefs, dr);
one_inserted = true;
}
}
*************** find_data_references_in_loop (struct loo
*** 4103,4109 ****
DR_OFFSET_MISALIGNMENT (res) = NULL_TREE;
DR_MEMTAG (res) = NULL_TREE;
DR_PTR_INFO (res) = NULL;
! VARRAY_PUSH_GENERIC_PTR (*datarefs, res);
free (bbs);
return chrec_dont_know;
--- 4080,4086 ----
DR_OFFSET_MISALIGNMENT (res) = NULL_TREE;
DR_MEMTAG (res) = NULL_TREE;
DR_PTR_INFO (res) = NULL;
! VEC_safe_push (data_reference_p, heap, datarefs, res);
free (bbs);
return chrec_dont_know;
*************** find_loop_nest (struct loop *loop, VEC (
*** 4164,4183 ****
}
/* Given a loop nest LOOP, the following vectors are returned:
! *DATAREFS is initialized to all the array elements contained in this loop,
! *DEPENDENCE_RELATIONS contains the relations between the data references.
Compute read-read and self relations if
COMPUTE_SELF_AND_READ_READ_DEPENDENCES is TRUE. */
void
compute_data_dependences_for_loop (struct loop *loop,
bool compute_self_and_read_read_dependences,
! varray_type *datarefs,
! varray_type *dependence_relations)
{
- unsigned int i;
- VEC(ddr_p,heap) *allrelations;
- struct data_dependence_relation *ddr;
struct loop *loop_nest = loop;
VEC (loop_p, heap) *vloops = VEC_alloc (loop_p, heap, 3);
--- 4141,4157 ----
}
/* Given a loop nest LOOP, the following vectors are returned:
! DATAREFS is initialized to all the array elements contained in this loop,
! DEPENDENCE_RELATIONS contains the relations between the data references.
Compute read-read and self relations if
COMPUTE_SELF_AND_READ_READ_DEPENDENCES is TRUE. */
void
compute_data_dependences_for_loop (struct loop *loop,
bool compute_self_and_read_read_dependences,
! VEC (data_reference_p, heap) *datarefs,
! VEC (ddr_p, heap) *dependence_relations)
{
struct loop *loop_nest = loop;
VEC (loop_p, heap) *vloops = VEC_alloc (loop_p, heap, 3);
*************** compute_data_dependences_for_loop (struc
*** 4195,4214 ****
/* Insert a single relation into dependence_relations:
chrec_dont_know. */
ddr = initialize_data_dependence_relation (NULL, NULL, vloops);
! VARRAY_PUSH_GENERIC_PTR (*dependence_relations, ddr);
}
else
! {
! allrelations = NULL;
! 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))
{
--- 4169,4179 ----
/* Insert a single relation into dependence_relations:
chrec_dont_know. */
ddr = initialize_data_dependence_relation (NULL, NULL, vloops);
! VEC_safe_push (ddr_p, heap, dependence_relations, ddr);
}
else
! compute_all_dependences (datarefs, dependence_relations, vloops,
! compute_self_and_read_read_dependences);
if (dump_file && (dump_flags & TDF_STATS))
{
*************** static void
*** 4285,4302 ****
analyze_all_data_dependences (struct loops *loops)
{
unsigned int i;
- varray_type datarefs;
- varray_type dependence_relations;
int nb_data_refs = 10;
!
! VARRAY_GENERIC_PTR_INIT (datarefs, nb_data_refs, "datarefs");
! VARRAY_GENERIC_PTR_INIT (dependence_relations,
! nb_data_refs * nb_data_refs,
! "dependence_relations");
/* Compute DDs on the whole function. */
compute_data_dependences_for_loop (loops->parray[0], false,
! &datarefs, &dependence_relations);
if (dump_file)
{
--- 4250,4264 ----
analyze_all_data_dependences (struct loops *loops)
{
unsigned int i;
int nb_data_refs = 10;
! VEC (data_reference_p, heap) *datarefs =
! VEC_alloc (data_reference_p, heap, nb_data_refs);
! VEC (ddr_p, heap) *dependence_relations =
! VEC_alloc (ddr_p, heap, nb_data_refs * nb_data_refs);
/* Compute DDs on the whole function. */
compute_data_dependences_for_loop (loops->parray[0], false,
! datarefs, dependence_relations);
if (dump_file)
{
*************** analyze_all_data_dependences (struct loo
*** 4312,4323 ****
unsigned nb_bot_relations = 0;
unsigned nb_basename_differ = 0;
unsigned nb_chrec_relations = 0;
! for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_relations); i++)
{
- struct data_dependence_relation *ddr;
- ddr = VARRAY_GENERIC_PTR (dependence_relations, i);
-
if (chrec_contains_undetermined (DDR_ARE_DEPENDENT (ddr)))
nb_top_relations++;
--- 4274,4283 ----
unsigned nb_bot_relations = 0;
unsigned nb_basename_differ = 0;
unsigned nb_chrec_relations = 0;
+ struct data_dependence_relation *ddr;
! for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++)
{
if (chrec_contains_undetermined (DDR_ARE_DEPENDENT (ddr)))
nb_top_relations++;
*************** free_dependence_relation (struct data_de
*** 4358,4364 ****
return;
if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE && DDR_SUBSCRIPTS (ddr))
! varray_clear (DDR_SUBSCRIPTS (ddr));
free (ddr);
}
--- 4318,4325 ----
return;
if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE && DDR_SUBSCRIPTS (ddr))
! VEC_free (subscript_p, heap, DDR_SUBSCRIPTS (ddr));
!
free (ddr);
}
*************** free_dependence_relation (struct data_de
*** 4366,4402 ****
DEPENDENCE_RELATIONS. */
void
! free_dependence_relations (varray_type dependence_relations)
{
unsigned int i;
! if (dependence_relations == NULL)
! return;
! for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_relations); i++)
! free_dependence_relation (VARRAY_GENERIC_PTR (dependence_relations, i));
! varray_clear (dependence_relations);
}
/* Free the memory used by the data references from DATAREFS. */
void
! free_data_refs (varray_type datarefs)
{
unsigned int i;
!
! if (datarefs == NULL)
! return;
! for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
{
! struct data_reference *dr = (struct data_reference *)
! VARRAY_GENERIC_PTR (datarefs, i);
! if (dr)
! {
! DR_FREE_ACCESS_FNS (dr);
! free (dr);
! }
}
! varray_clear (datarefs);
}
--- 4327,4360 ----
DEPENDENCE_RELATIONS. */
void
! free_dependence_relations (VEC (ddr_p, heap) *dependence_relations)
{
unsigned int i;
! struct data_dependence_relation *ddr;
! for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++)
! free_dependence_relation (ddr);
!
! VEC_free (ddr_p, heap, dependence_relations);
}
/* Free the memory used by the data references from DATAREFS. */
void
! free_data_refs (VEC (data_reference_p, heap) *datarefs)
{
unsigned int i;
! struct data_reference *dr;
! for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
! if (DR_TYPE(dr) == ARRAY_REF_TYPE)
! VEC_free (tree, heap, (dr)->object_info.access_fns);
! else
! VEC_free (tree, heap, (dr)->first_location.access_fns);
!
! free (dr);
}
! VEC_free (data_reference_p, heap, datarefs);
}
Index: tree-data-ref.h
===================================================================
*** tree-data-ref.h (revision 112436)
--- tree-data-ref.h (working copy)
*************** struct data_reference
*** 107,112 ****
--- 107,116 ----
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
*************** struct subscript
*** 181,186 ****
--- 185,194 ----
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
*************** struct data_dependence_relation
*** 219,234 ****
/* 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;
/* The analyzed loop nest. */
VEC (loop_p, heap) *loop_nest;
/* The classic direction vector. */
! VEC(lambda_vector,heap) *dir_vects;
/* The classic distance vector. */
! VEC(lambda_vector,heap) *dist_vects;
};
typedef struct data_dependence_relation *ddr_p;
--- 227,242 ----
/* 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. */
! 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;
/* The classic distance vector. */
! VEC (lambda_vector, heap) *dist_vects;
};
typedef struct data_dependence_relation *ddr_p;
*************** DEF_VEC_ALLOC_P(ddr_p,heap);
*** 240,249 ****
#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_LOOP_NEST(DDR) DDR->loop_nest
/* The size of the direction/distance vectors: the number of loops in
--- 248,255 ----
#define DDR_AFFINE_P(DDR) DDR->affine_p
#define DDR_ARE_DEPENDENT(DDR) DDR->are_dependent
#define DDR_SUBSCRIPTS(DDR) DDR->subscripts
! #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
*************** DEF_VEC_ALLOC_P(ddr_p,heap);
*** 263,291 ****
! extern tree find_data_references_in_loop (struct loop *, varray_type *);
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 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_data_reference (FILE *, struct data_reference *);
! 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 *,
struct data_dependence_relation *);
! extern void dump_data_dependence_relations (FILE *, varray_type);
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 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
--- 269,300 ----
! extern tree find_data_references_in_loop (struct loop *,
! VEC (data_reference_p, heap) *);
extern void compute_data_dependences_for_loop (struct loop *, bool,
! 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 *, 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 *, 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 *, 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 (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
*************** index_in_loop_nest (int var, VEC (loop_p
*** 302,307 ****
return var_index;
}
!
#endif /* GCC_TREE_DATA_REF_H */
--- 311,317 ----
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 */
Index: tree-vect-analyze.c
===================================================================
*** tree-vect-analyze.c (revision 112436)
--- tree-vect-analyze.c (working copy)
*************** static bool
*** 679,696 ****
vect_analyze_data_ref_dependences (loop_vec_info loop_vinfo)
{
unsigned int i;
! varray_type ddrs = LOOP_VINFO_DDRS (loop_vinfo);
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;
! }
return true;
}
--- 679,693 ----
vect_analyze_data_ref_dependences (loop_vec_info loop_vinfo)
{
unsigned int i;
! 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; VEC_iterate (ddr_p, ddrs, i, ddr); i++)
! if (vect_analyze_data_ref_dependence (ddr, loop_vinfo))
! return false;
return true;
}
*************** vect_compute_data_ref_alignment (struct
*** 812,826 ****
static bool
vect_compute_data_refs_alignment (loop_vec_info loop_vinfo)
{
! varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
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;
! }
return true;
}
--- 809,821 ----
static bool
vect_compute_data_refs_alignment (loop_vec_info loop_vinfo)
{
! VEC (data_reference_p, heap) *datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
! struct data_reference *dr;
unsigned int i;
! for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
! if (!vect_compute_data_ref_alignment (dr))
! return false;
return true;
}
*************** vect_update_misalignment_for_peel (struc
*** 884,896 ****
static bool
vect_verify_datarefs_alignment (loop_vec_info loop_vinfo)
{
! varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
enum dr_alignment_support supportable_dr_alignment;
unsigned int i;
! for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
{
- struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i);
supportable_dr_alignment = vect_supportable_dr_alignment (dr);
if (!supportable_dr_alignment)
{
--- 879,891 ----
static bool
vect_verify_datarefs_alignment (loop_vec_info 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; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
supportable_dr_alignment = vect_supportable_dr_alignment (dr);
if (!supportable_dr_alignment)
{
*************** vect_verify_datarefs_alignment (loop_vec
*** 1007,1013 ****
static bool
vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
{
! varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
enum dr_alignment_support supportable_dr_alignment;
struct data_reference *dr0 = NULL;
struct data_reference *dr;
--- 1002,1008 ----
static bool
vect_enhance_data_refs_alignment (loop_vec_info 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;
*************** vect_enhance_data_refs_alignment (loop_v
*** 1055,1070 ****
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;
! }
! }
/* 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. */
--- 1050,1062 ----
TODO: Use a cost model. */
! 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. */
*************** vect_enhance_data_refs_alignment (loop_v
*** 1088,1100 ****
}
/* Ensure that all data refs can be vectorized after the peel. */
! for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); 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);
--- 1080,1092 ----
}
/* Ensure that all data refs can be vectorized after the peel. */
! for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
int save_misalignment;
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);
*************** vect_enhance_data_refs_alignment (loop_v
*** 1116,1128 ****
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;
vect_update_misalignment_for_peel (dr, dr0, npeel);
- }
LOOP_VINFO_UNALIGNED_DR (loop_vinfo) = dr0;
LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo) = DR_MISALIGNMENT (dr0);
--- 1108,1116 ----
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; 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);
*************** vect_enhance_data_refs_alignment (loop_v
*** 1154,1163 ****
if (do_versioning)
{
! for (i = 0; i < VARRAY_ACTIVE_SIZE (datarefs); i++)
{
- dr = VARRAY_GENERIC_PTR (datarefs, i);
-
if (aligned_access_p (dr))
continue;
--- 1142,1149 ----
if (do_versioning)
{
! for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
if (aligned_access_p (dr))
continue;
*************** static bool
*** 1303,1323 ****
vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo)
{
unsigned int i;
! varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
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;
! }
! }
return true;
}
--- 1289,1307 ----
vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo)
{
unsigned int i;
! 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; 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;
}
*************** vect_analyze_data_refs (loop_vec_info lo
*** 1342,1363 ****
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
unsigned int i;
! varray_type datarefs;
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)));
/* 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++)
{
- struct data_reference *dr = VARRAY_GENERIC_PTR (datarefs, i);
tree stmt;
stmt_vec_info stmt_info;
--- 1326,1348 ----
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
unsigned int i;
! 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));
/* 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; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
tree stmt;
stmt_vec_info stmt_info;
Index: lambda.h
===================================================================
*** lambda.h (revision 112436)
--- lambda.h (working copy)
*************** lambda_loopnest lambda_loopnest_transfor
*** 143,149 ****
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))
--- 143,148 ----
Index: lambda-code.c
===================================================================
*** lambda-code.c (revision 112436)
--- lambda-code.c (working copy)
*************** perfect_nestify (struct loops *loops,
*** 2578,2584 ****
bool
lambda_transform_legal_p (lambda_trans_matrix trans,
int nb_loops,
! varray_type dependence_relations)
{
unsigned int i, j;
lambda_vector distres;
--- 2578,2584 ----
bool
lambda_transform_legal_p (lambda_trans_matrix trans,
int nb_loops,
! VEC (ddr_p, heap) *dependence_relations)
{
unsigned int i, j;
lambda_vector distres;
*************** lambda_transform_legal_p (lambda_trans_m
*** 2589,2596 ****
/* 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);
if (ddr == NULL)
return true;
if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
--- 2589,2595 ----
/* 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 = VEC_index (ddr_p, dependence_relations, 0);
if (ddr == NULL)
return true;
if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
*************** lambda_transform_legal_p (lambda_trans_m
*** 2599,2609 ****
distres = lambda_vector_new (nb_loops);
/* For each distance vector in the dependence graph. */
! for (i = 0; i < VARRAY_ACTIVE_SIZE (dependence_relations); 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. */
--- 2598,2605 ----
distres = lambda_vector_new (nb_loops);
/* For each distance vector in the dependence graph. */
! for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); 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. */
Index: tree-vect-transform.c
===================================================================
*** tree-vect-transform.c (revision 112436)
--- tree-vect-transform.c (working copy)
*************** static void
*** 2769,2784 ****
vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters)
{
unsigned int i;
! varray_type datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
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);
! }
}
--- 2769,2782 ----
vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters)
{
unsigned int i;
! 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; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
! vect_update_init_of_dr (dr, niters);
}
Index: Makefile.in
===================================================================
*** Makefile.in (revision 112436)
--- Makefile.in (working copy)
*************** tree-browser.o : tree-browser.c tree-bro
*** 2046,2052 ****
$(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)
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) \
--- 2046,2052 ----
$(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) $(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) \
*************** tree-loop-linear.o: tree-loop-linear.c $
*** 2078,2084 ****
$(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)
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
--- 2078,2084 ----
$(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
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
*************** ifcvt.o : ifcvt.c $(CONFIG_H) $(SYSTEM_H
*** 2582,2590 ****
$(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)
lambda-trans.o: lambda-trans.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_H) \
! $(TM_H) coretypes.h $(TARGET_H) $(TREE_H) $(VARRAY_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) \
--- 2582,2590 ----
$(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)
lambda-trans.o: lambda-trans.c $(LAMBDA_H) $(GGC_H) $(SYSTEM_H) $(CONFIG_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) \