[llvm-commits] [llvm] r153341 - /llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Mar 29 09:07:23 PDT 2012


On Mar 23, 2012, at 10:33 AM, Lang Hames wrote:

> +    // Record any overlaps with regmask operands.
> +    BitVector regMaskOverlaps(tri->getNumRegs());
> +    for (ArrayRef<SlotIndex>::iterator rmItr = regMaskSlots.begin(),
> +                                       rmEnd = regMaskSlots.end();
> +         rmItr != rmEnd; ++rmItr) {
> +      SlotIndex rmIdx = *rmItr;
> +      if (vregLI->liveAt(rmIdx)) {
> +        MachineInstr *rmMI = lis->getInstructionFromIndex(rmIdx);
> +        const uint32_t* regMask = 0;
> +        for (MachineInstr::mop_iterator mopItr = rmMI->operands_begin(),
> +                                        mopEnd = rmMI->operands_end();
> +             mopItr != mopEnd; ++mopItr) {
> +          if (mopItr->isRegMask()) {
> +            regMask = mopItr->getRegMask();
> +            break;
> +          }
> +        }
> +        assert(regMask != 0 && "Couldn't find register mask.");
> +        regMaskOverlaps.setBitsNotInMask(regMask);
>       }
> +    }

LiveIntervals::checkRegMaskInterference() already does this.

> +    for (unsigned preg = 0; preg < tri->getNumRegs(); ++preg) {
> +      if (regMaskOverlaps.test(preg))
> +        overlappingPRegs.insert(preg);
> +    }

You can use BitVector::find_first / find_next here.

/jakob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120329/a64fa99c/attachment.html>


More information about the llvm-commits mailing list