public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Delay branch scheduling vs. the CFG
@ 2005-11-16 22:42 Joern RENNECKE
  0 siblings, 0 replies; 7+ messages in thread
From: Joern RENNECKE @ 2005-11-16 22:42 UTC (permalink / raw)
  To: Jeffrey A Law; +Cc: Steven Bosscher, gcc

 > > >   4. An entirely new basic block on its own.
 > >
 > > When can option 4 happen??
 > IIRC it occurs when there was only 1 insn in either the target
 > or fall-thru block.    When it gets sucked into the delay
 > slot of a branch, then it is effectively its own basic
 > block.

When the fall-through is ended by a code label, and has only one insn, 
and that is eligible for
a delay-slot which can be annulled-true, the fall-through block can end 
up in the delay slot.

When the target block is ended by an unconditional jump, and otherwise 
has only one insn,
which is elegible for a delay slot in preceding branch that can be 
anulled-false, the fall-through
block can end up in the delay slot.
Likwise if the fall-through block consists only of a branch-delay-slot 
eligible insn  and
an unconditional jump, the branch and fall-through block can be 
converted into an inverted
branch with anulled-false delay slot insn.

And finally, sometimes earlier reorg changes have changed the data flow 
so that actually
no anulled slots are required (if there were no changes before, jump 
optimization should
have caught these opportunities, placing the lone insn in front of the 
branch); or the only
data anti-dependency might have the branch condition itself.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Delay branch scheduling vs. the CFG
  2005-11-16 20:07       ` Richard Henderson
@ 2005-11-16 23:19         ` Jeffrey A Law
  0 siblings, 0 replies; 7+ messages in thread
From: Jeffrey A Law @ 2005-11-16 23:19 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Steven Bosscher, gcc

On Wed, 2005-11-16 at 12:06 -0800, Richard Henderson wrote:
> On Sun, Nov 13, 2005 at 02:26:31PM -0700, Jeffrey A Law wrote:
> > On Sun, 2005-11-13 at 22:20 +0100, Steven Bosscher wrote:
> > > On Sunday 13 November 2005 22:02, Jeffrey A Law wrote:
> > > > No great insights on how to make dbr_schedule CFG aware -- just
> > > > remember that a filled delay slot can represent 3 different cases:
> > > >
> > > >   1. An extension of the block containing the sequence.
> > > >
> > > >   2. An extension of the block at the target of a branch.
> > > >
> > > >   3. An extension of the fall-thru block.
> > > >
> > > >   4. An entirely new basic block on its own.
> > > 
> > > When can option 4 happen??
> > IIRC it occurs when there was only 1 insn in either the target
> > or fall-thru block.    When it gets sucked into the delay
> > slot of a branch, then it is effectively its own basic
> > block.
> 
> I'd be comfortable modeling all of these as (1), with the
> understanding that the delay slots may be conditionally
> executed, as if with cond_exec.
Seems clean enough to me.
jeff


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Delay branch scheduling vs. the CFG
  2005-11-13 21:26     ` Jeffrey A Law
@ 2005-11-16 20:07       ` Richard Henderson
  2005-11-16 23:19         ` Jeffrey A Law
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2005-11-16 20:07 UTC (permalink / raw)
  To: Jeffrey A Law; +Cc: Steven Bosscher, gcc

On Sun, Nov 13, 2005 at 02:26:31PM -0700, Jeffrey A Law wrote:
> On Sun, 2005-11-13 at 22:20 +0100, Steven Bosscher wrote:
> > On Sunday 13 November 2005 22:02, Jeffrey A Law wrote:
> > > No great insights on how to make dbr_schedule CFG aware -- just
> > > remember that a filled delay slot can represent 3 different cases:
> > >
> > >   1. An extension of the block containing the sequence.
> > >
> > >   2. An extension of the block at the target of a branch.
> > >
> > >   3. An extension of the fall-thru block.
> > >
> > >   4. An entirely new basic block on its own.
> > 
> > When can option 4 happen??
> IIRC it occurs when there was only 1 insn in either the target
> or fall-thru block.    When it gets sucked into the delay
> slot of a branch, then it is effectively its own basic
> block.

I'd be comfortable modeling all of these as (1), with the
understanding that the delay slots may be conditionally
executed, as if with cond_exec.


r~

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Delay branch scheduling vs. the CFG
  2005-11-13 21:20   ` Steven Bosscher
@ 2005-11-13 21:26     ` Jeffrey A Law
  2005-11-16 20:07       ` Richard Henderson
  0 siblings, 1 reply; 7+ messages in thread
From: Jeffrey A Law @ 2005-11-13 21:26 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: gcc

On Sun, 2005-11-13 at 22:20 +0100, Steven Bosscher wrote:
> On Sunday 13 November 2005 22:02, Jeffrey A Law wrote:
> > No great insights on how to make dbr_schedule CFG aware -- just
> > remember that a filled delay slot can represent 3 different cases:
> >
> >   1. An extension of the block containing the sequence.
> >
> >   2. An extension of the block at the target of a branch.
> >
> >   3. An extension of the fall-thru block.
> >
> >   4. An entirely new basic block on its own.
> 
> When can option 4 happen??
IIRC it occurs when there was only 1 insn in either the target
or fall-thru block.    When it gets sucked into the delay
slot of a branch, then it is effectively its own basic
block.

Or something along those lines -- it's been about 15 years since
I've had to reconstruct CFGs from PA assembly code and branch
traces ;)


jeff


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Delay branch scheduling vs. the CFG
  2005-11-13 21:02 ` Jeffrey A Law
@ 2005-11-13 21:20   ` Steven Bosscher
  2005-11-13 21:26     ` Jeffrey A Law
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Bosscher @ 2005-11-13 21:20 UTC (permalink / raw)
  To: law; +Cc: gcc

On Sunday 13 November 2005 22:02, Jeffrey A Law wrote:
> No great insights on how to make dbr_schedule CFG aware -- just
> remember that a filled delay slot can represent 3 different cases:
>
>   1. An extension of the block containing the sequence.
>
>   2. An extension of the block at the target of a branch.
>
>   3. An extension of the fall-thru block.
>
>   4. An entirely new basic block on its own.

When can option 4 happen??

Gr.
Steven

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Delay branch scheduling vs. the CFG
  2005-11-13 20:20 Steven Bosscher
@ 2005-11-13 21:02 ` Jeffrey A Law
  2005-11-13 21:20   ` Steven Bosscher
  0 siblings, 1 reply; 7+ messages in thread
From: Jeffrey A Law @ 2005-11-13 21:02 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: gcc

On Sun, 2005-11-13 at 21:20 +0100, Steven Bosscher wrote:
> Hi,
> 
> I'm trying to figure out how much effort it would take to make
> dbr_schedule CFG aware.  One of the issues I'm running into is
> that the RTL CFG stuff doesn't support SEQUENCEs at all.  So if
> I have a delay slot filled, e.g.,
> 
> (sequence [
>     (jump_insn (...))   ;; The branch with delay slots
>     (insn (...))        ;; An insn in a delay slot
>     ])
> 
> verify_flow_info immediately dies on this because the last insn
> in a basic block is not a branch instruction.  It sees just the
> sequence and not the instructions in it.
> 
> Now I could add some kind of flag "reorg_completed" and go hack
> all the RTL cfg routines to support SEQUENCEs.  But I'd rather
> not do that unless I'm really sure nobody thinks that is a Very
> Bad Idea.  ;-)
No great insights on how to make dbr_schedule CFG aware -- just
remember that a filled delay slot can represent 3 different cases:

  1. An extension of the block containing the sequence.

  2. An extension of the block at the target of a branch.

  3. An extension of the fall-thru block.

  4. An entirely new basic block on its own.

Firing out which of these cases holds can be nontrivial.


I'm not sure what you're trying to accomplish, but if you're
really interested in improving reorg, a huge step in the right
direction would be to have it use insn dependency information
to determine what insns are candidates for filling delay slots.

The net result is all the resource tracking nonsense goes away
as do the compile-time issues associated with it. 

Jeff


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Delay branch scheduling vs. the CFG
@ 2005-11-13 20:20 Steven Bosscher
  2005-11-13 21:02 ` Jeffrey A Law
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Bosscher @ 2005-11-13 20:20 UTC (permalink / raw)
  To: gcc

Hi,

I'm trying to figure out how much effort it would take to make
dbr_schedule CFG aware.  One of the issues I'm running into is
that the RTL CFG stuff doesn't support SEQUENCEs at all.  So if
I have a delay slot filled, e.g.,

(sequence [
    (jump_insn (...))   ;; The branch with delay slots
    (insn (...))        ;; An insn in a delay slot
    ])

verify_flow_info immediately dies on this because the last insn
in a basic block is not a branch instruction.  It sees just the
sequence and not the instructions in it.

Now I could add some kind of flag "reorg_completed" and go hack
all the RTL cfg routines to support SEQUENCEs.  But I'd rather
not do that unless I'm really sure nobody thinks that is a Very
Bad Idea.  ;-)

Thoughts?

Gr.
Steven

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-11-16 23:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-16 22:42 Delay branch scheduling vs. the CFG Joern RENNECKE
  -- strict thread matches above, loose matches on Subject: below --
2005-11-13 20:20 Steven Bosscher
2005-11-13 21:02 ` Jeffrey A Law
2005-11-13 21:20   ` Steven Bosscher
2005-11-13 21:26     ` Jeffrey A Law
2005-11-16 20:07       ` Richard Henderson
2005-11-16 23:19         ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).