diff options
| author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-12-15 14:09:52 +0000 |
|---|---|---|
| committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-12-15 14:09:52 +0000 |
| commit | 9ceb03fb1d6c11959fdabb963045678abc433166 (patch) | |
| tree | 07ee2603be7b91d1376ec27122c5879e3b30e5b6 | |
| parent | 5d907c3a8a526697cc50bb894321d398c94e5e35 (diff) | |
| download | ppe42-gcc-9ceb03fb1d6c11959fdabb963045678abc433166.tar.gz ppe42-gcc-9ceb03fb1d6c11959fdabb963045678abc433166.zip | |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30954 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 7 | ||||
| -rw-r--r-- | gcc/flow.c | 17 |
2 files changed, 20 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b300d613c6d..ddd8eacf20c 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 a16d0ed5b28..0d6bb891c19 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; |

