This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix comments that refer to ENTRY_{BLOCK|EXIT}_PTR
- From: Michael Matz <matz at suse dot de>
- To: Jeff Law <law at redhat dot com>
- Cc: David Malcolm <dmalcolm at redhat dot com>, Jan-Benedict Glaw <jbglaw at lug-owl dot de>, Steven Bosscher <stevenb dot gcc at gmail dot com>, gcc-patches at gcc dot gnu dot org, Richard Sandiford <rdsandiford at googlemail dot com>
- Date: Tue, 26 Nov 2013 16:38:44 +0100 (CET)
- Subject: Re: [PATCH] Fix comments that refer to ENTRY_{BLOCK|EXIT}_PTR
- Authentication-results: sourceware.org; auth=none
- References: <20131120090429 dot GT30563 at lug-owl dot de> <CABu31nOxDcuTvsGVU6YrLmd_ZEkuon8hiUNMoPk466F5WAkOGA at mail dot gmail dot com> <20131120100703 dot GV30563 at lug-owl dot de> <1384967011 dot 11568 dot 154 dot camel at surprise> <528CFF43 dot 4080407 at redhat dot com>
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.