aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-loop-distribution.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2013-10-15 10:21:32 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2013-10-15 10:21:32 +0000
commit24f161fddabfaae005e73795c676b2701ecbef60 (patch)
tree2eefdd78a4b5434027f7a4a95f54d27466ede338 /gcc/tree-loop-distribution.c
parent5de989edfb971e43d009307fc273f0d561f1c50f (diff)
downloadgcc-24f161fddabfaae005e73795c676b2701ecbef60.zip
gcc-24f161fddabfaae005e73795c676b2701ecbef60.tar.gz
gcc-24f161fddabfaae005e73795c676b2701ecbef60.tar.bz2
tree-loop-distribution.c (build_empty_rdg): Inline into single user.
2013-10-15 Richard Biener <rguenther@suse.de> * tree-loop-distribution.c (build_empty_rdg): Inline into single user. (rdg_flag_vertex): Inline into single user. (rdg_flag_vertex_and_dependent): Likewise. (build_rdg_partition_for_vertex): Remove processed bitmap. (rdg_build_partitions): Simplify. From-SVN: r203592
Diffstat (limited to 'gcc/tree-loop-distribution.c')
-rw-r--r--gcc/tree-loop-distribution.c85
1 files changed, 17 insertions, 68 deletions
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 44be6cb..015b50d 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -471,17 +471,6 @@ stmts_from_loop (struct loop *loop, vec<gimple> *stmts)
free (bbs);
}
-/* Build the Reduced Dependence Graph (RDG) with one vertex per
- statement of the loop nest, and one edge per data dependence or
- scalar dependence. */
-
-struct graph *
-build_empty_rdg (int n_stmts)
-{
- struct graph *rdg = new_graph (n_stmts);
- return rdg;
-}
-
/* Free the reduced dependence graph RDG. */
static void
@@ -526,7 +515,7 @@ build_rdg (vec<loop_p> loop_nest, control_dependences *cd)
/* Create the RDG vertices from the stmts of the loop nest. */
stmts.create (10);
stmts_from_loop (loop_nest[0], &stmts);
- rdg = build_empty_rdg (stmts.length ());
+ rdg = new_graph (stmts.length ());
datarefs.create (10);
if (!create_rdg_vertices (rdg, stmts, loop_nest[0], &datarefs))
{
@@ -1037,52 +1026,28 @@ generate_code_for_partition (struct loop *loop,
}
-/* Flag V from RDG as part of PARTITION, and also flag its loop number
- in LOOPS. */
-
-static void
-rdg_flag_vertex (struct graph *rdg, int v, partition_t partition)
-{
- struct loop *loop;
-
- if (!bitmap_set_bit (partition->stmts, v))
- return;
-
- loop = loop_containing_stmt (RDG_STMT (rdg, v));
- bitmap_set_bit (partition->loops, loop->num);
-}
-
-/* Flag in the bitmap PARTITION the vertex V and all its predecessors.
- Also flag their loop number in LOOPS. */
+/* Returns a partition with all the statements needed for computing
+ the vertex V of the RDG, also including the loop exit conditions. */
-static void
-rdg_flag_vertex_and_dependent (struct graph *rdg, int v, partition_t partition,
- bitmap processed)
+static partition_t
+build_rdg_partition_for_vertex (struct graph *rdg, int v)
{
- unsigned i;
+ partition_t partition = partition_alloc (NULL, NULL);
vec<int> nodes;
- nodes.create (3);
+ unsigned i;
int x;
+ nodes.create (3);
graphds_dfs (rdg, &v, 1, &nodes, false, NULL);
FOR_EACH_VEC_ELT (nodes, i, x)
- if (bitmap_set_bit (processed, x))
- rdg_flag_vertex (rdg, x, partition);
+ {
+ bitmap_set_bit (partition->stmts, x);
+ bitmap_set_bit (partition->loops,
+ loop_containing_stmt (RDG_STMT (rdg, x))->num);
+ }
nodes.release ();
-}
-
-/* Returns a partition with all the statements needed for computing
- the vertex V of the RDG, also including the loop exit conditions. */
-
-static partition_t
-build_rdg_partition_for_vertex (struct graph *rdg, int v)
-{
- partition_t partition = partition_alloc (NULL, NULL);
- bitmap processed = BITMAP_ALLOC (NULL);
- rdg_flag_vertex_and_dependent (rdg, v, partition, processed);
- BITMAP_FREE (processed);
return partition;
}
@@ -1318,24 +1283,22 @@ rdg_build_partitions (struct graph *rdg,
bitmap processed = BITMAP_ALLOC (NULL);
int i;
gimple stmt;
- partition_t partition = partition_alloc (NULL, NULL);
FOR_EACH_VEC_ELT (starting_stmts, i, stmt)
{
- partition_t np;
int v = rdg_vertex_for_stmt (rdg, stmt);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
"ldist asked to generate code for vertex %d\n", v);
+ /* If the vertex is already contained in another partition so
+ is the partition rooted at it. */
if (bitmap_bit_p (processed, v))
continue;
- np = build_rdg_partition_for_vertex (rdg, v);
- bitmap_ior_into (partition->stmts, np->stmts);
- bitmap_ior_into (processed, np->stmts);
- partition_free (np);
+ partition_t partition = build_rdg_partition_for_vertex (rdg, v);
+ bitmap_ior_into (processed, partition->stmts);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -1344,25 +1307,11 @@ rdg_build_partitions (struct graph *rdg,
}
partitions->safe_push (partition);
- partition = partition_alloc (NULL, NULL);
}
/* All vertices should have been assigned to at least one partition now,
other than vertices belonging to dead code. */
- if (!bitmap_empty_p (partition->stmts))
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "remaining partition:\n");
- dump_bitmap (dump_file, partition->stmts);
- }
-
- partitions->safe_push (partition);
- }
- else
- partition_free (partition);
-
BITMAP_FREE (processed);
}