aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@freesoft.cz>1999-12-15 15:09:52 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>1999-12-15 14:09:52 +0000
commitce4bbac71c009c87e902148838b7c4ef6f8be27b (patch)
tree07ee2603be7b91d1376ec27122c5879e3b30e5b6
parent41bd0db1f02ae60cd58f5d79ad01cff22931a841 (diff)
downloadgcc-ce4bbac71c009c87e902148838b7c4ef6f8be27b.zip
gcc-ce4bbac71c009c87e902148838b7c4ef6f8be27b.tar.gz
gcc-ce4bbac71c009c87e902148838b7c4ef6f8be27b.tar.bz2
flow.c (dump_flow_info): Dump loop_depth.
* flow.c (dump_flow_info): Dump loop_depth. (flow_loop_nodes_find): Increase loop_depth for basic block in the body. (flow_loop_find): Initialize the loop_depth for each basic block. From-SVN: r30954
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/flow.c17
2 files changed, 20 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b300d61..ddd8eac 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+Wed Dec 15 15:05:30 MET 1999 Jan Hubicka <hubicka@freesoft.cz>
+
+ * flow.c (dump_flow_info): Dump loop_depth.
+ (flow_loops_nodes_find): Increase loop_depth for basic block in the
+ body.
+ (flow_loops_find): Initialize the loop_depth for each basic block.
+
1999-12-15 Jason Merrill <jason@casey.cygnus.com>
* tree.c (decl_function_context): Handle virtual functions.
diff --git a/gcc/flow.c b/gcc/flow.c
index a16d0ed..0d6bb89 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -4968,8 +4968,8 @@ dump_flow_info (file)
register int regno;
register edge e;
- fprintf (file, "\nBasic block %d: first insn %d, last %d.\n",
- i, INSN_UID (bb->head), INSN_UID (bb->end));
+ fprintf (file, "\nBasic block %d: first insn %d, last %d, loop_depth %d.\n",
+ i, INSN_UID (bb->head), INSN_UID (bb->end), bb->loop_depth);
fprintf (file, "Predecessors: ");
for (e = bb->pred; e ; e = e->pred_next)
@@ -6574,11 +6574,13 @@ flow_loop_nodes_find (header, latch, nodes)
sbitmap_zero (nodes);
SET_BIT (nodes, header->index);
num_nodes++;
+ header->loop_depth++;
/* Push the loop latch on to the stack. */
if (! TEST_BIT (nodes, latch->index))
{
SET_BIT (nodes, latch->index);
+ latch->loop_depth++;
num_nodes++;
stack[sp++] = latch;
}
@@ -6599,6 +6601,7 @@ flow_loop_nodes_find (header, latch, nodes)
&& ! TEST_BIT (nodes, ancestor->index))
{
SET_BIT (nodes, ancestor->index);
+ ancestor->loop_depth++;
num_nodes++;
stack[sp++] = ancestor;
}
@@ -6832,7 +6835,8 @@ flow_loops_level_compute (loops)
}
-/* Find all the natural loops in the function and save in LOOPS structure.
+/* Find all the natural loops in the function and save in LOOPS structure
+ and recalculate loop_depth information in basic block structures.
Return the number of natural loops found. */
int
flow_loops_find (loops)
@@ -6861,10 +6865,15 @@ flow_loops_find (loops)
compute_flow_dominators (dom, NULL);
/* Count the number of loop edges (back edges). This should be the
- same as the number of natural loops. */
+ same as the number of natural loops. Also clear the loop_depth
+ and as we work from inner->outer in a loop nest we call
+ find_loop_nodes_find which will increment loop_depth for nodes
+ within the current loop, which happens to enclose inner loops. */
+
num_loops = 0;
for (b = 0; b < n_basic_blocks; b++)
{
+ BASIC_BLOCK (b)->loop_depth = 1;
for (e = BASIC_BLOCK (b)->pred; e; e = e->pred_next)
{
basic_block latch = e->src;