This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: basic_block index negative?


On Wed, 17 Oct 2001, Daniel Egger wrote:

> Am Mit, 2001-10-17 um 17.11 schrieb 1003331515:
> 
> > ENTRY_BLOCK_PTR and EXIT_BLOCK_PTR have negative index numbers
> > (-1 and -2 respectively).
> 
> Thanks. Is there a special reason why those blocks have negative
> indices?
>  
Dunno.  I guess because they're special and contain no program
instructions.  The tree SSA code uses it to tell whether it found
a ghost definition (artificial definitions created by SSA).


> > It's also important to keep the index as a signed int to allow
> > reverse traversals of the bb array.
> 
> Sorry, I can't follow you here...
> 
If the index is unsigned, then a reverse traversal could get into
an infinite loop.  Consider:

for (i = n_basic_blocks - 1; i >= 0; i--)
  ...


Diego.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]