<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Mar 23, 2012, at 10:33 AM, Lang Hames wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Optima; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">+    // Record any overlaps with regmask operands.<br>+    BitVector regMaskOverlaps(tri->getNumRegs());<br>+    for (ArrayRef<SlotIndex>::iterator rmItr = regMaskSlots.begin(),<br>+                                       rmEnd = regMaskSlots.end();<br>+         rmItr != rmEnd; ++rmItr) {<br>+      SlotIndex rmIdx = *rmItr;<br>+      if (vregLI->liveAt(rmIdx)) {<br>+        MachineInstr *rmMI = lis->getInstructionFromIndex(rmIdx);<br>+        const uint32_t* regMask = 0;<br>+        for (MachineInstr::mop_iterator mopItr = rmMI->operands_begin(),<br>+                                        mopEnd = rmMI->operands_end();<br>+             mopItr != mopEnd; ++mopItr) {<br>+          if (mopItr->isRegMask()) {<br>+            regMask = mopItr->getRegMask();<br>+            break;<br>+          }<br>+        }<br>+        assert(regMask != 0 && "Couldn't find register mask.");<br>+        regMaskOverlaps.setBitsNotInMask(regMask);<br>      }<br>+    }<br></span></span></blockquote><div><br></div><div>LiveIntervals::checkRegMaskInterference() already does this.</div><div><br></div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Optima; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">+    for (unsigned preg = 0; preg < tri->getNumRegs(); ++preg) {<br>+      if (regMaskOverlaps.test(preg))<br>+        overlappingPRegs.insert(preg);<br>+    }<br></span></span></blockquote><div><br></div><div>You can use BitVector::find_first / find_next here.</div><div><br></div><div>/jakob</div><div><br></div></div></body></html>