This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [PATCH] Fix comments that refer to ENTRY_{BLOCK|EXIT}_PTR


Hi,

On Wed, 20 Nov 2013, Jeff Law wrote:

> > There are three places the patch doesn't touch:
> > 
> > (A) cfgbuild.c (make_edges) has this comment:
> >    /* By nature of the way these get numbered, ENTRY_BLOCK_PTR->next_bb
> > block
> >       is always the entry.  */
> > where the meaning wasn't immediately clear to me - what is the second
> > "entry" here?  (I haven't looked in detail at the algorithm).
> 
> Hmm, I think "the entry" should be "the exit".

No, "the entry" is correct but misleading.  There are two entry 
categories: ENTRY_BLOCK (containing no instructions, and once was block 
-1) and the first entered basic block containing instructions, which by 
convention is ENTRY_BLOCK_PTR->next_bb (and once was numbered 0), 
sometimes called "the entry".

The reason for this seemingly useless additional BB is the potential 
support for functions with multiple entry points.  All these real entry 
points would be successors of the ENTRY_BLOCK, simply because normal CFG 
algorithms are usually expressed with a single entry point of the CFG.  
The support for multiple entry points was never completed, so there's only 
one real entry block, which nevertheless is the (single) successor of 
ENTRY_BLOCK.

Same for EXIT_BLOCK, all blocks containing real code that make the 
function exit ("the exits") are predecessors of the single EXIT_BLOCK, so 
that the reverse CFG also has only a single entry point.

> My recollection is ENTRY_BLOCK is block #0 and EXIT_BLOCK is block #1.  
> But that would mean we're making a edge from the entry to the exit?!?


Ciao,
Michael.


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