Live Intervals and Finding the next usage

I have a live interval, and I would like to find out what SlotIndex the next use the register will occur? Is there any way to map a live interval back into instructions or SlotIndexes or blocks used by?

  • Thanks
    Jeff Kunkel

I am looking for the slot index of a register around the given slot index Min. Is there a better way than the linear search:

findDefUsesAroundIndex( LiveInterval* li, SlotIndex Min )

for( MachineOperand * mo = MRI->getRegUseDefListHead(li->reg);
mo; mo = mo->getNextOperandForReg() )
SlotIndex si = SI->getInstructionIndex( use.getOperand().getParent() );
if( Min.distance(si) >= 0 )

  • Thanks
    Jeff Kunkel

Not really, you have to use the use-def chain. See SplitAnalysis::analyzeUses().


If I had more than just the one requirement, I would use SplitAnalysis. It provides quite a descriptive list of dependencies for the live interval. However, since I only have the one requirement, I will retain the current code. Although, I will use the MachineRegisterInfo::reg_nodbg_iterator. I believe this is what I need.

Jeff Kunkel