[LLVMdev] Some questions about live intervals

Roman Levenstein
Thu, 31 Jan 2008 20:40:29 -0000

Hi Bill,
--- Bill Wendling <isanbard at gmail.com> schrieb:

> > I already started work on the implementation of this algorithm and
> have a few hopefully rather simple questions:
> >
> > 1) What is the easiest way to understand which MBB a given
> > instruction index belongs to? All the required information is
> > available in the MBB2IdxMap of the LiveIntervalAnalysis class.
Would > > it be useful to
> add a small function getMBBFromIndex() to this class?
> >

> The MachineInstr class has a pointer to its MachineBasicBlock (at
> least in top-of-tree). Call "getParent()" on the MachineInstr.

This is true. But sometimes, when you work with LiveIntervals, you use
start/end indexes coming from live ranges of an interval. And when you
call getInstructionFromIndex(start/end index), you sometimes get the
NULL pointer back, since instruction with this index was removed in the
meantime due to coalescing or something else. Then you still face a
problem of determining which BB this instruction index belongs to, but
you cannot use the trick proposed by you above. Does it explain more
clearly my problem and a reason for a proposed solution?

-Roman


      Lesen Sie Ihre E-Mails jetzt einfach von unterwegs.