This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [graphite] instancewise dependence analysis functions and structures
Hi,
I've committed the attached patch that is a subset of the fixes that you sent.
Sebastian
2008-02-22 Konrad Trifunovic <konrad.trifunovic@inria.fr>
* tree-data-ref.c (build_empty_rdg): New.
(build_rdg): Use it.
* tree-data-ref.h (build_empty_rdg): Declared.
* graphite.c (free_scop): Free SCOP_LOOP2CLOOG_LOOP.
(find_vertex_for_stmt): Removed.
(build_rdg_all_levels): Use build_empty_rdg and rdg_vertex_for_stmt.
Index: graphite.c
===================================================================
--- graphite.c (revision 132346)
+++ graphite.c (working copy)
@@ -574,6 +574,7 @@ free_scop (scop_p scop)
VEC_free (loop_p, heap, SCOP_LOOP_NEST (scop));
VEC_free (tree, heap, SCOP_PARAMS (scop));
cloog_program_free (SCOP_PROG (scop));
+ htab_delete (SCOP_LOOP2CLOOG_LOOP (scop));
free (scop);
}
@@ -1617,22 +1618,6 @@ initialize_dependence_polyhedron (scop_p
return dep_constraints;
}
-/* Returns the index of STMT in RDG.
- TODO: remove this function, replace with rdg_vertex_for_stmt. */
-
-static int
-find_vertex_for_stmt (const struct graph *rdg, const_tree stmt)
-{
- int i;
-
- for (i = 0; i < rdg->n_vertices; i++)
- if (RDGV_STMT (&(rdg->vertices[i])) == stmt)
- return i;
-
- gcc_unreachable ();
- return 0;
-}
-
/* Returns a new dependence polyhedron for data references A and B. */
static struct data_dependence_polyhedron *
@@ -1814,14 +1799,13 @@ build_rdg_all_levels (scop_p scop)
}
}
- rdg = new_graph (VEC_length (tree, stmts));
+ rdg = build_empty_rdg (VEC_length (tree, stmts));
create_rdg_vertices (rdg, stmts);
for (i = 0; VEC_iterate (ddp_p, ddps, i, ddp); i++)
{
- /* TODO: replace find_vertex_for_stmt with rdg_vertex_for_stmt. */
- va = find_vertex_for_stmt (rdg, DR_STMT (ddp->a));
- vb = find_vertex_for_stmt (rdg, DR_STMT (ddp->b));
+ va = rdg_vertex_for_stmt (rdg, DR_STMT (ddp->a));
+ vb = rdg_vertex_for_stmt (rdg, DR_STMT (ddp->b));
e = add_edge (rdg, va, vb);
e->data = ddp;
}
Index: tree-data-ref.c
===================================================================
--- tree-data-ref.c (revision 132318)
+++ tree-data-ref.c (working copy)
@@ -3984,7 +3984,7 @@ get_references_in_stmt (tree stmt, VEC (
/* Stores the data references in STMT to DATAREFS. If there is an unanalyzable
reference, returns false, otherwise returns true. NEST is the outermost
- loop of the loop nest in that the references should be analyzed. */
+ loop of the loop nest in which the references should be analyzed. */
bool
find_data_references_in_stmt (struct loop *nest, tree stmt,
@@ -4727,6 +4727,19 @@ hash_stmt_vertex_del (void *e)
free (e);
}
+/* Build an empty Reduced Dependence Graph (RDG). */
+
+struct graph *
+build_empty_rdg (int n_stmts)
+{
+ int nb_data_refs = 10;
+ struct graph *rdg = new_graph (n_stmts);
+
+ rdg->indexes = htab_create (nb_data_refs, hash_stmt_vertex_info,
+ eq_stmt_vertex_info, hash_stmt_vertex_del);
+ return rdg;
+}
+
/* Build the Reduced Dependence Graph (RDG) with one vertex per
statement of the loop nest, and one edge per data dependence or
scalar dependence. */
@@ -4751,10 +4764,7 @@ build_rdg (struct loop *loop)
goto end_rdg;
stmts_from_loop (loop, &stmts);
- rdg = new_graph (VEC_length (tree, stmts));
-
- rdg->indexes = htab_create (nb_data_refs, hash_stmt_vertex_info,
- eq_stmt_vertex_info, hash_stmt_vertex_del);
+ rdg = build_empty_rdg (VEC_length (tree, stmts));
create_rdg_vertices (rdg, stmts);
create_rdg_edges (rdg, dependence_relations);
Index: tree-data-ref.h
===================================================================
--- tree-data-ref.h (revision 132318)
+++ tree-data-ref.h (working copy)
@@ -498,6 +498,7 @@ typedef struct rdg_edge
#define RDGE_LEVEL(E) ((struct rdg_edge *) ((E)->data))->level
struct graph *build_rdg (struct loop *);
+struct graph *build_empty_rdg (int);
void free_rdg (struct graph *);
/* Return the index of the variable VAR in the LOOP_NEST array. */