tree-data-ref.c (analyze_array_indexes, [...]): Use VEC instead of VARRAY.

* tree-data-ref.c (analyze_array_indexes, analyze_array,
	init_data_ref, access_functions_are_affine_or_constant_p,
	free_data_refs): Use VEC instead of VARRAY.
	* tree-data-ref.h (data_reference): Change the type of
	access_fns to VEC(tree,gc)*.
	(DR_ACCESS_FN, DR_NUM_DIMENSIONS): Use VEC instead of VARRAY.

From-SVN: r99517
This commit is contained in:
Kazu Hirata 2005-05-10 14:50:35 +00:00 committed by Kazu Hirata
parent 30dc60c78c
commit 9cbb7989ef
3 changed files with 21 additions and 14 deletions

View File

@ -4,6 +4,13 @@
config/sh/sh.md, config/sh/superh.h: Fix comment typos. config/sh/sh.md, config/sh/superh.h: Fix comment typos.
* doc/invoke.texi: Fix typos. * doc/invoke.texi: Fix typos.
* tree-data-ref.c (analyze_array_indexes, analyze_array,
init_data_ref, access_functions_are_affine_or_constant_p,
free_data_refs): Use VEC instead of VARRAY.
* tree-data-ref.h (data_reference): Change the type of
access_fns to VEC(tree,gc)*.
(DR_ACCESS_FN, DR_NUM_DIMENSIONS): Use VEC instead of VARRAY.
2005-05-10 Gabor Loki <loki@gcc.gnu.org> 2005-05-10 Gabor Loki <loki@gcc.gnu.org>
PR c/17913 PR c/17913

View File

@ -523,7 +523,7 @@ estimate_niter_from_size_of_data (struct loop *loop,
static tree static tree
analyze_array_indexes (struct loop *loop, analyze_array_indexes (struct loop *loop,
varray_type *access_fns, VEC(tree,heap) **access_fns,
tree ref, tree stmt) tree ref, tree stmt)
{ {
tree opnd0, opnd1; tree opnd0, opnd1;
@ -542,7 +542,7 @@ analyze_array_indexes (struct loop *loop,
if (loop->estimated_nb_iterations == NULL_TREE) if (loop->estimated_nb_iterations == NULL_TREE)
estimate_niter_from_size_of_data (loop, opnd0, access_fn, stmt); estimate_niter_from_size_of_data (loop, opnd0, access_fn, stmt);
VARRAY_PUSH_TREE (*access_fns, access_fn); VEC_safe_push (tree, heap, *access_fns, access_fn);
/* Recursively record other array access functions. */ /* Recursively record other array access functions. */
if (TREE_CODE (opnd0) == ARRAY_REF) if (TREE_CODE (opnd0) == ARRAY_REF)
@ -575,7 +575,7 @@ analyze_array (tree stmt, tree ref, bool is_read)
DR_STMT (res) = stmt; DR_STMT (res) = stmt;
DR_REF (res) = ref; DR_REF (res) = ref;
VARRAY_TREE_INIT (DR_ACCESS_FNS (res), 3, "access_fns"); DR_ACCESS_FNS (res) = VEC_alloc (tree, heap, 3);
DR_BASE_NAME (res) = analyze_array_indexes DR_BASE_NAME (res) = analyze_array_indexes
(loop_containing_stmt (stmt), &(DR_ACCESS_FNS (res)), ref, stmt); (loop_containing_stmt (stmt), &(DR_ACCESS_FNS (res)), ref, stmt);
DR_IS_READ (res) = is_read; DR_IS_READ (res) = is_read;
@ -610,9 +610,9 @@ init_data_ref (tree stmt,
DR_STMT (res) = stmt; DR_STMT (res) = stmt;
DR_REF (res) = ref; DR_REF (res) = ref;
VARRAY_TREE_INIT (DR_ACCESS_FNS (res), 5, "access_fns"); DR_ACCESS_FNS (res) = VEC_alloc (tree, heap, 5);
DR_BASE_NAME (res) = base; DR_BASE_NAME (res) = base;
VARRAY_PUSH_TREE (DR_ACCESS_FNS (res), access_fn); VEC_quick_push (tree, DR_ACCESS_FNS (res), access_fn);
DR_IS_READ (res) = is_read; DR_IS_READ (res) = is_read;
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
@ -2124,11 +2124,12 @@ static bool
access_functions_are_affine_or_constant_p (struct data_reference *a) access_functions_are_affine_or_constant_p (struct data_reference *a)
{ {
unsigned int i; unsigned int i;
varray_type fns = DR_ACCESS_FNS (a); VEC(tree,heap) **fns = &DR_ACCESS_FNS (a);
tree t;
for (i = 0; i < VARRAY_ACTIVE_SIZE (fns); i++) for (i = 0; VEC_iterate (tree, *fns, i, t); i++)
if (!evolution_function_is_constant_p (VARRAY_TREE (fns, i)) if (!evolution_function_is_constant_p (t)
&& !evolution_function_is_affine_multivariate_p (VARRAY_TREE (fns, i))) && !evolution_function_is_affine_multivariate_p (t))
return false; return false;
return true; return true;
@ -2457,8 +2458,7 @@ free_data_refs (varray_type datarefs)
VARRAY_GENERIC_PTR (datarefs, i); VARRAY_GENERIC_PTR (datarefs, i);
if (dr) if (dr)
{ {
if (DR_ACCESS_FNS (dr)) VEC_free (tree, heap, DR_ACCESS_FNS (dr));
varray_clear (DR_ACCESS_FNS (dr));
free (dr); free (dr);
} }
} }

View File

@ -36,7 +36,7 @@ struct data_reference
tree base_name; tree base_name;
/* A list of chrecs. */ /* A list of chrecs. */
varray_type access_fns; VEC(tree,heap) *access_fns;
/* Auxiliary info specific to a pass. */ /* Auxiliary info specific to a pass. */
int aux; int aux;
@ -50,8 +50,8 @@ struct data_reference
#define DR_REF(DR) DR->ref #define DR_REF(DR) DR->ref
#define DR_BASE_NAME(DR) DR->base_name #define DR_BASE_NAME(DR) DR->base_name
#define DR_ACCESS_FNS(DR) DR->access_fns #define DR_ACCESS_FNS(DR) DR->access_fns
#define DR_ACCESS_FN(DR, I) VARRAY_TREE (DR_ACCESS_FNS (DR), I) #define DR_ACCESS_FN(DR, I) VEC_index (tree, DR_ACCESS_FNS (DR), I)
#define DR_NUM_DIMENSIONS(DR) VARRAY_ACTIVE_SIZE (DR_ACCESS_FNS (DR)) #define DR_NUM_DIMENSIONS(DR) VEC_length (tree, DR_ACCESS_FNS (DR))
#define DR_IS_READ(DR) DR->is_read #define DR_IS_READ(DR) DR->is_read
enum data_dependence_direction { enum data_dependence_direction {