From: Daniel Berlin <dberlin@dberlin.org>
To: sean yang <seanatpurdue@hotmail.com>
CC: gcc@gcc.gnu.org, seanatpurdue@purdue.edu
Subject: Re: identifying a BB representing a self-loop
Date: Fri, 19 May 2006 15:41:30 -0400
sean yang wrote:
> Some basic blocks may represent a (self) loop, but GCC's internal basic
> block representation won't show such information explicitly (i.e., it
won't
> store a self-loop edge).
> My question is, when I walk through basic blocks, can I identify then
> easily?
>
> E.g., Let's say,
> ----------demo.c------------------------------------
> int main(){
> int i;
> int sum = 0;
> for (i=0; i< 10; i++){
> sum = sum+i;
> }
> }
> -----------------------------------------------------
> If we compile this by "#gcc -c -O -da demo.c, we can see there are only
> three BBs. Actually, BB1 is a self-looped basic block. But this loop
> information is not explicitly expressed.
>
What do you mean "not explicitly expressed".
If you call the loop finding routines (flow_loops_find), and look in the
result loop information, does it not give you a loop with a single node?