[llvm] r182490 - Add the IncludeSelf parameter to the MCSubRegIterator and MCSuperRegIterator

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed May 22 14:25:42 PDT 2013


On May 22, 2013, at 11:46 AM, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:

> On 22 May 2013 13:26, Chad Rosier <mcrosier at apple.com> wrote:
>> Author: mcrosier
>> Date: Wed May 22 12:26:26 2013
>> New Revision: 182490
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=182490&view=rev
>> Log:
>> Add the IncludeSelf parameter to the MCSubRegIterator and MCSuperRegIterator
>> constructors.  No functional change.
>> Part of rdar://12906217
> 
> Can you provide a bit more context on how this will be used?

Take a look at LiveIntervals::computeRegUnitInterval(). It could be a lot simpler if MCSuperRegIterator also returned Reg itself:

  // The physregs aliasing Unit are the roots and their super-registers.
  // Create all values as dead defs before extending to uses. Note that roots
  // may share super-registers. That's OK because createDeadDefs() is
  // idempotent. It is very rare for a register unit to have multiple roots, so
  // uniquing super-registers is probably not worthwhile.
  for (MCRegUnitRootIterator Roots(Unit, TRI); Roots.isValid(); ++Roots) {
    unsigned Root = *Roots;
    if (!MRI->reg_empty(Root))
      LRCalc->createDeadDefs(LI, Root);
    for (MCSuperRegIterator Supers(Root, TRI); Supers.isValid(); ++Supers) {
      if (!MRI->reg_empty(*Supers))
        LRCalc->createDeadDefs(LI, *Supers);
    }
  }

  // Now extend LI to reach all uses.
  // Ignore uses of reserved registers. We only track defs of those.
  for (MCRegUnitRootIterator Roots(Unit, TRI); Roots.isValid(); ++Roots) {
    unsigned Root = *Roots;
    if (!MRI->isReserved(Root) && !MRI->reg_empty(Root))
      LRCalc->extendToUses(LI, Root);
    for (MCSuperRegIterator Supers(Root, TRI); Supers.isValid(); ++Supers) {
      unsigned Reg = *Supers;
      if (!MRI->isReserved(Reg) && !MRI->reg_empty(Reg))
        LRCalc->extendToUses(LI, Reg);
    }
  }

/jakob





More information about the llvm-commits mailing list