This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa-lno] vectorizer patch.
Hi,
The following patch cleans the interface used by the vectorizer.
Committed after bootstrap on i686-pc-linux-gnu.
2004-01-02 Sebastian Pop <s.pop@laposte.net>
* tree-data-ref.c (vec_analyze_array): Renamed to analyze_array.
(analyze_array): Removed.
(find_data_references): Adapted to use the new analyze_array
function.
(array_base_name_differ_p): Moved to tree-data-ref.h.
(vec_array_base_name_differ_p): Removed.
* tree-data-ref.h (array_base_name_differ_p): Moved here.
* tree-vectorizer.c (vect_analyze_data_ref_dependence): Use
array_base_name_differ_p instead of vec_array_base_name_differ_p.
(vect_analyze_data_refs): Use analyze_array instead of
vec_analyze_array.
(vectorize_loops): Remove the initializers and finalizers of the
scalar evolution analyzer.
Index: tree-data-ref.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-data-ref.c,v
retrieving revision 1.1.2.2
diff -d -u -p -r1.1.2.2 tree-data-ref.c
--- tree-data-ref.c 1 Jan 2004 20:16:25 -0000 1.1.2.2
+++ tree-data-ref.c 2 Jan 2004 12:06:57 -0000
@@ -89,7 +89,6 @@ Software Foundation, 59 Temple Place - S
#include "tree-data-ref.h"
#include "tree-scalar-evolution.h"
-static void analyze_array (struct loop *, varray_type, tree, tree);
static tree analyze_array_indexes (struct loop *, varray_type, tree);
static bool access_functions_are_affine_or_constant_p (struct data_reference *);
@@ -98,8 +97,6 @@ initialize_data_dependence_relation (str
struct data_reference *);
static void compute_all_dependences (varray_type, varray_type);
-static inline bool array_base_name_differ_p (struct data_reference *, struct data_reference *);
-
static void subscript_dependence_tester (struct data_dependence_relation *);
static void subscript_coupling_tester (struct data_dependence_relation *);
@@ -394,9 +391,8 @@ analyze_array_indexes (struct loop *loop
initialize a DATA_REFERENCE structure, and push it in the DATAREFS
array. */
-static void
+struct data_reference *
analyze_array (struct loop *loop_nest,
- varray_type datarefs,
tree expr,
tree ref)
{
@@ -409,27 +405,8 @@ analyze_array (struct loop *loop_nest,
VARRAY_TREE_INIT (DR_ACCESS_FNS (res), 5, "access_fns");
DR_BASE_NAME (res) = analyze_array_indexes (loop_nest, DR_ACCESS_FNS (res), ref);
- VARRAY_PUSH_GENERIC_PTR (datarefs, res);
-}
-
-/* DN */
-struct data_reference *
-vec_analyze_array (struct loop *loop_nest,
- tree expr,
- tree ref)
-{
- struct data_reference *res;
- res = ggc_alloc (sizeof (struct data_reference));
-
- res->id = data_ref_id++;
- res->expr = expr;
- res->ref = ref;
- VARRAY_TREE_INIT (res->access_fns, 3, "access_fns");
- res->base_name = analyze_array_indexes (loop_nest, res->access_fns, ref);
-
return res;
}
-/* DN */
@@ -566,43 +543,6 @@ compute_all_dependences (varray_type dat
/* This section contains the affine functions dependences detector. */
-/* This is the simplest data dependence test: determines whether the
- data references A and B access the same array. */
-
-static inline bool
-array_base_name_differ_p (struct data_reference *a,
- struct data_reference *b)
-{
- if (DR_BASE_NAME (a) == DR_BASE_NAME (b))
- return false;
-
- if (TREE_CODE (DR_BASE_NAME (a)) == INDIRECT_REF
- && TREE_CODE (DR_BASE_NAME (b)) == INDIRECT_REF
- && TREE_OPERAND (DR_BASE_NAME (a), 0)
- == TREE_OPERAND (DR_BASE_NAME (b), 0))
- return false;
-
- return true;
-}
-
-/* DN */
-bool
-vec_array_base_name_differ_p (struct data_reference *a,
- struct data_reference *b)
-{
- if (DR_BASE_NAME (a) == DR_BASE_NAME (b))
- return false;
-
- if (TREE_CODE (DR_BASE_NAME (a)) == INDIRECT_REF
- && TREE_CODE (DR_BASE_NAME (b)) == INDIRECT_REF
- && TREE_OPERAND (DR_BASE_NAME (a), 0)
- == TREE_OPERAND (DR_BASE_NAME (b), 0))
- return false;
-
- return true;
-}
-/* DN */
-
/* This is the subscript dependence tester (SubDT). */
static void
@@ -810,11 +750,15 @@ find_data_references (struct loop *loop_
a modify expression is either an ARRAY_REF or
otherwise it does not contain other ARRAY_REFs. */
if (TREE_CODE (TREE_OPERAND (expr, 0)) == ARRAY_REF)
- analyze_array (loop_nest, datarefs, expr,
- TREE_OPERAND (expr, 0));
+ VARRAY_PUSH_GENERIC_PTR
+ (datarefs, analyze_array (loop_nest, expr,
+ TREE_OPERAND (expr, 0)));
+
if (TREE_CODE (TREE_OPERAND (expr, 1)) == ARRAY_REF)
- analyze_array (loop_nest, datarefs, expr,
- TREE_OPERAND (expr, 1));
+ VARRAY_PUSH_GENERIC_PTR
+ (datarefs, analyze_array (loop_nest, expr,
+ TREE_OPERAND (expr, 1)));
+
break;
case COND_EXPR:
Index: tree-data-ref.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-data-ref.h,v
retrieving revision 1.1.2.2
diff -d -u -p -r1.1.2.2 tree-data-ref.h
--- tree-data-ref.h 1 Jan 2004 20:16:25 -0000 1.1.2.2
+++ tree-data-ref.h 2 Jan 2004 12:06:57 -0000
@@ -152,8 +152,33 @@ extern void dump_data_dependence_relatio
extern void dump_data_dependence_direction (FILE *,
enum data_dependence_direction);
-/* API for vectorizer */
-extern bool vec_array_base_name_differ_p (struct data_reference *, struct data_reference *);
-extern struct data_reference *vec_analyze_array (struct loop *, tree, tree);
+extern struct data_reference *analyze_array (struct loop *, tree, tree);
+
+
+
+/* Inline functions. */
+
+static inline bool array_base_name_differ_p (struct data_reference *, struct data_reference *);
+
+
+/* This is the simplest data dependence test: determines whether the
+ data references A and B access the same array. */
+
+static inline bool
+array_base_name_differ_p (struct data_reference *a,
+ struct data_reference *b)
+{
+ if (DR_BASE_NAME (a) == DR_BASE_NAME (b))
+ return false;
+
+ if (TREE_CODE (DR_BASE_NAME (a)) == INDIRECT_REF
+ && TREE_CODE (DR_BASE_NAME (b)) == INDIRECT_REF
+ && TREE_OPERAND (DR_BASE_NAME (a), 0)
+ == TREE_OPERAND (DR_BASE_NAME (b), 0))
+ return false;
+
+ return true;
+}
+
#endif /* GCC_TREE_DATA_REF_H */
Index: tree-vectorizer.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-vectorizer.c,v
retrieving revision 1.1.2.1
diff -d -u -p -r1.1.2.1 tree-vectorizer.c
--- tree-vectorizer.c 1 Jan 2004 20:16:24 -0000 1.1.2.1
+++ tree-vectorizer.c 2 Jan 2004 12:06:58 -0000
@@ -1703,7 +1703,7 @@ vect_analyze_data_ref_dependence (struct
This had been verified by analyze_data_refs.
This restriction will be relaxed in the future. */
- if (! vec_array_base_name_differ_p (dra, drb))
+ if (! array_base_name_differ_p (dra, drb))
{
DBG_VECT (fprintf (stderr,
"vect_analyze_data_ref_dependence: same base\n"));
@@ -1972,7 +1972,7 @@ vect_analyze_data_refs (loop_vec_info lo
return false;
}
- dr = vec_analyze_array (loop, stmt, ref);
+ dr = analyze_array (loop, stmt, ref);
/* FORNOW: make sure that the array is one dimentional.
This restriction will be relaxed in the future.
@@ -2593,9 +2593,6 @@ vectorize_loops (tree fndecl,
vars_to_rename = vars;
- /* ----------- Initializations. ----------- */
- initialize_scalar_evolutions_analyzer ();
-
/* ----------- Analyze loops. ----------- */
/* CHECKME */
for (i = 1; i < loops->num; i++)
@@ -2647,8 +2644,6 @@ vectorize_loops (tree fndecl,
loop_vec_info loop_vinfo = loop->aux;
destroy_loop_vec_info (loop_vinfo);
}
-
- finalize_scalar_evolutions_analyzer ();
timevar_pop (TV_TREE_VECTORIZATION);