diff options
Diffstat (limited to 'gcc/cfgloopanal.c')
-rw-r--r-- | gcc/cfgloopanal.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c index 9b3ffa0c8ae..63d6f4121b0 100644 --- a/gcc/cfgloopanal.c +++ b/gcc/cfgloopanal.c @@ -457,3 +457,20 @@ expected_loop_iterations (const struct loop *loop) return (freq_latch + freq_in - 1) / freq_in; } } + +/* Returns the maximum level of nesting of subloops of LOOP. */ + +unsigned +get_loop_level (const struct loop *loop) +{ + const struct loop *ploop; + unsigned mx = 0, l; + + for (ploop = loop->inner; ploop; ploop = ploop->next) + { + l = get_loop_level (ploop); + if (l >= mx) + mx = l + 1; + } + return mx; +} |