summaryrefslogtreecommitdiff
path: root/gcc/tree-data-ref.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-20 19:11:56 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-20 19:11:56 +0000
commitb79b3386e82cd23eb4b0dd4951b7d813c0f33b94 (patch)
treeea4cf8fac1c14940e25a8a624cebe081009b766c /gcc/tree-data-ref.c
parent2e4a272a4282723e9a873ee6a0a97c88170f2642 (diff)
downloadgcc-b79b3386e82cd23eb4b0dd4951b7d813c0f33b94.tar.gz
2008-05-20 Jan Sjodin <jan.sjodin@amd.com>
Sebastian Pop <sebastian.pop@amd.com> * tree-loop-linear.c (gather_interchange_stats): Look in the access matrix, and never look at the tree representation of the memory accesses. (linear_transform_loops): Computes parameters and access matrices. * tree-data-ref.c (compute_data_dependences_for_loop): Returns false when fails. (access_matrix_get_index_for_parameter): New. * tree-data-ref.h (struct access_matrix): New. (AM_LOOP_NEST_NUM, AM_NB_INDUCTION_VARS, AM_PARAMETERS, AM_MATRIX, AM_NB_PARAMETERS, AM_CONST_COLUMN_INDEX, AM_NB_COLUMNS, AM_GET_SUBSCRIPT_ACCESS_VECTOR, AM_GET_ACCESS_MATRIX_ELEMENT, am_vector_index_for_loop): New. (struct data_reference): Add field access_matrix. (DR_ACCESS_MATRIX): New. (compute_data_dependences_for_loop): Update declaration. (lambda_collect_parameters, lambda_compute_access_matrices): Declared. * lambda.h (lambda_vector_vec_p): Declared. * lambda-code.c: Depend on pointer-set.h. (lambda_collect_parameters_from_af, lambda_collect_parameters, av_for_af_base, av_for_af, build_access_matrix, lambda_compute_access_matrices): New. * Makefile.in (lambda-code.o): Depend on pointer-set.h. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135672 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r--gcc/tree-data-ref.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 75545496a17..bf9516cd672 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -4180,18 +4180,20 @@ find_loop_nest (struct loop *loop, VEC (loop_p, heap) **loop_nest)
return true;
}
-/* Given a loop nest LOOP, the following vectors are returned:
+/* Returns true when the data dependences have been computed, false otherwise.
+ 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
+bool
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)
{
+ bool res = true;
VEC (loop_p, heap) *vloops = VEC_alloc (loop_p, heap, 3);
memset (&dependence_stats, 0, sizeof (dependence_stats));
@@ -4209,6 +4211,7 @@ compute_data_dependences_for_loop (struct loop *loop,
chrec_dont_know. */
ddr = initialize_data_dependence_relation (NULL, NULL, vloops);
VEC_safe_push (ddr_p, heap, *dependence_relations, ddr);
+ res = false;
}
else
compute_all_dependences (*datarefs, dependence_relations, vloops,
@@ -4260,7 +4263,9 @@ compute_data_dependences_for_loop (struct loop *loop,
dependence_stats.num_miv_independent);
fprintf (dump_file, "Number of miv tests unimplemented: %d\n",
dependence_stats.num_miv_unimplemented);
- }
+ }
+
+ return res;
}
/* Entry point (for testing only). Analyze all the data references
@@ -5032,3 +5037,20 @@ remove_similar_memory_refs (VEC (tree, heap) **stmts)
htab_delete (seen);
}
+/* Returns the index of PARAMETER in the parameters vector of the
+ ACCESS_MATRIX. If PARAMETER does not exist return -1. */
+
+int
+access_matrix_get_index_for_parameter (tree parameter,
+ struct access_matrix *access_matrix)
+{
+ int i;
+ VEC (tree,heap) *lambda_parameters = AM_PARAMETERS (access_matrix);
+ tree lambda_parameter;
+
+ for (i = 0; VEC_iterate (tree, lambda_parameters, i, lambda_parameter); i++)
+ if (lambda_parameter == parameter)
+ return i + AM_NB_INDUCTION_VARS (access_matrix);
+
+ return -1;
+}