[llvm] r175382 - Add support for updating the LiveIntervals of registers used by 'exotic'

Jakob Stoklund Olesen stoklund at 2pi.dk
Sat Feb 16 18:40:53 PST 2013


On Feb 16, 2013, at 6:30 PM, Cameron Zwarich <zwarich at apple.com> wrote:

> On Feb 16, 2013, at 6:22 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
> 
>> On Feb 16, 2013, at 4:10 PM, Cameron Zwarich <zwarich at apple.com> wrote:
>> 
>>> +    void repairIntervalsInRange(MachineBasicBlock *MBB,
>>> +                                MachineBasicBlock::reverse_iterator RBegin,
>>> +                                MachineBasicBlock::reverse_iterator REnd,
>>> +                                SmallVectorImpl<unsigned> &OrigRegs);
>> 
>> I think it is too confusing to use reverse_iterators in an API. Can't you keep that detail internal to the function? Better yet, just use -- to move backwards.
> 
> I originally wrote it that way, but it felt awkward since we are iterating backwards over an interval (A, B] not forward over an interval [A, B). I guess you are just suggesting that I do the conversion from left-open to right-open intervals in the function itself.

Yes, but even then I usually just use:

for (iterator I = End; I != Begin;) {
  --I;
  use(I);
}

It's less confusing IMHO.

Note that dereferencing a MachineBasicBlock::reverse_iterator causes it to scan the whole bundle it is pointing to:

  reference operator*() const {__t = current; return *--__t;}

/jakob





More information about the llvm-commits mailing list