diff options
author | Michael Hayes <m.hayes@elec.canterbury.ac.nz> | 2000-01-23 23:10:09 +0000 |
---|---|---|
committer | Michael Hayes <m.hayes@gcc.gnu.org> | 2000-01-23 23:10:09 +0000 |
commit | d6181b1bdcbc6df86c0a589b7ed9905ee634aa3e (patch) | |
tree | b1bc6f8655c4fc318b0bfa0bb32853a20303f802 /gcc | |
parent | 7e259f255fcf3d41e85f0ec2dec1143983c4d828 (diff) | |
download | gcc-d6181b1bdcbc6df86c0a589b7ed9905ee634aa3e.zip gcc-d6181b1bdcbc6df86c0a589b7ed9905ee634aa3e.tar.gz gcc-d6181b1bdcbc6df86c0a589b7ed9905ee634aa3e.tar.bz2 |
basic-block.h (struct loops): New field `levels'.
2000-01-24 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* basic-block.h (struct loops): New field `levels'.
* flow.c (flow_loops_level_compute): Traverse all outer loops.
(flow_loop_level_compute): Initialise level to 1.
(flow_loops_find): Set loops->levels.
(flow_loops_dump): Print loops->levels.
From-SVN: r31577
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/basic-block.h | 3 | ||||
-rw-r--r-- | gcc/flow.c | 25 |
3 files changed, 30 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e8b5574..b00f9af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2000-01-24 Michael Hayes <m.hayes@elec.canterbury.ac.nz> + + * basic-block.h (struct loops): New field `levels'. + * flow.c (flow_loops_level_compute): Traverse all outer loops. + (flow_loop_level_compute): Initialise level to 1. + (flow_loops_find): Set loops->levels. + (flow_loops_dump): Print loops->levels. + 2000-01-23 Richard Henderson <rth@cygnus.com> * libgcc2.c (dwarf_reg_size_table): Size with DWARF_FRAME_REGISTERS. diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 912d1ef..c5c29c9 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -325,6 +325,9 @@ struct loops /* Number of natural loops in the function. */ int num; + /* Maxium nested loop level in the function. */ + int levels; + /* Array of natural loop descriptors (scanning this array in reverse order will find the inner loops before their enclosing outer loops). */ struct loop *array; @@ -6387,7 +6387,8 @@ flow_loops_dump (loops, file, verbose) if (! num_loops || ! file) return; - fprintf (file, ";; %d loops found\n", num_loops); + fprintf (file, ";; %d loops found, %d levels\n", + num_loops, loops->levels); for (i = 0; i < num_loops; i++) { @@ -6783,7 +6784,7 @@ flow_loop_level_compute (loop, depth) int depth; { struct loop *inner; - int level = 0; + int level = 1; if (! loop) return 0; @@ -6791,7 +6792,8 @@ flow_loop_level_compute (loop, depth) /* Traverse loop tree assigning depth and computing level as the maximum level of all the inner loops of this loop. The loop level is equivalent to the height of the loop in the loop tree - and corresponds to the number of enclosed loop levels. */ + and corresponds to the number of enclosed loop levels (including + itself). */ for (inner = loop->inner; inner; inner = inner->next) { int ilevel; @@ -6811,11 +6813,22 @@ flow_loop_level_compute (loop, depth) hierarchy tree specfied by LOOPS. Return the maximum enclosed loop level. */ -static int +static int flow_loops_level_compute (loops) struct loops *loops; { - return flow_loop_level_compute (loops->tree, 1); + struct loop *loop; + int level; + int levels = 0; + + /* Traverse all the outer level loops. */ + for (loop = loops->tree; loop; loop = loop->next) + { + level = flow_loop_level_compute (loop, 1); + if (level > levels) + levels = level; + } + return levels; } @@ -6970,7 +6983,7 @@ flow_loops_find (loops) /* Assign the loop nesting depth and enclosed loop level for each loop. */ - flow_loops_level_compute (loops); + loops->levels = flow_loops_level_compute (loops); return num_loops; } |