[LLVMdev] LiveInterval Splitting & SubRegisters

David Greene dag at cray.com
Wed Jan 23 14:12:58 PST 2008


On Wednesday 23 January 2008 02:01, Evan Cheng wrote:

> > Can you explain the basic mechanics of the live interval splitting
> > code?

> It's splitting live intervals that span multiple basic blocks. That
> is, when an interval is spilled, it introduce a single reload per
> basic block and retarget all the uses to use the result of the single
> reload. It does not (yet) split intra-bb intervals.

Ah, got it.  Thanks.

> > Also, in the ancient subregister coalescing code, there used to be
> > an update
> > of the SSARegMap to point subregisters to the superregister they were
> > coalesced to (IIRC).  That has since gone away.  I used to use that
> > in my
> > code to return the correct live interval for a virtual register in
> > the case
> > where a subregister extract was coalesced.
>
> Right. That has been removed because it's surprisingly painful to
> maintain that information. Now subreg index lives on MachineOperand.

Yep, I saw that.  Does the subregh index in the MachineOperand tell the
asm printer what name to output for a register operand?  How else is
it used?

> > That information appears to now be in RegSubIdxMap, which is local to
> > runOnMachineFunction, so it's lost after the coalescer runs.  Do I
> > not need
> > to worry about this information anymore?
>
> That's used at the end of coalescing to rewrite virtual registers.
> It's purely local information.

Ok, I see where that is happening (the coalescer sets the subreg in
the MachineOperand).  I'm worried here about the case where an
EXTRACT_SUBREG targeting two virtual registers is coalesced.
How does the LiveInterval information change?  Since the coalescer
always coalesces to the superregister, I'm guesing that LiveIntervals
will have an (extended) interval for the superregister and NO interval
foir the subregister after coalescing is done (since the subregister
was coalesced away).  Then when the AsmPrinter comes along, it
sees the subregister set in the MachineOperand and does the
Right Thing(tm) even though the MachineOperand register is in
fact the superregister.  Correct?  Any other stuff happening besides
this?

Thanks for your help!

                                             -Dave



More information about the llvm-dev mailing list