[llvm-commits] [llvm] r103685 - /llvm/trunk/lib/CodeGen/RegAllocFast.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed May 12 17:19:39 PDT 2010


Author: stoklund
Date: Wed May 12 19:19:39 2010
New Revision: 103685

URL: http://llvm.org/viewvc/llvm-project?rev=103685&view=rev
Log:
More asserts around physreg uses

Modified:
    llvm/trunk/lib/CodeGen/RegAllocFast.cpp

Modified: llvm/trunk/lib/CodeGen/RegAllocFast.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocFast.cpp?rev=103685&r1=103684&r2=103685&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocFast.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocFast.cpp Wed May 12 19:19:39 2010
@@ -487,7 +487,7 @@
 }
 
 /// reservePhysReg - Mark PhysReg as reserved. This is very similar to
-/// defineVirtReg except the physreg is reverved instead of allocated.
+/// defineVirtReg except the physreg is reserved instead of allocated.
 void RAFast::reservePhysReg(MachineBasicBlock &MBB, MachineInstr *MI,
                             unsigned PhysReg) {
   UsedInInstr.set(PhysReg);
@@ -623,6 +623,16 @@
       if (!Reg || !TargetRegisterInfo::isPhysicalRegister(Reg) ||
           ReservedRegs.test(Reg)) continue;
       if (MO.isUse()) {
+#ifndef NDEBUG
+        // We are using a physreg directly. It had better not be clobbered by a
+        // virtreg.
+        assert(PhysRegState[Reg] <= regReserved && "Using clobbered physreg");
+        if (PhysRegState[Reg] == regDisabled)
+          for (const unsigned *AS = TRI->getAliasSet(Reg);
+               unsigned Alias = *AS; ++AS)
+            assert(PhysRegState[Alias] <= regReserved &&
+                   "Physreg alias was clobbered");
+#endif
         PhysKills.push_back(Reg); // Any clean physreg use is a kill.
         UsedInInstr.set(Reg);
       } else if (MO.isEarlyClobber()) {





More information about the llvm-commits mailing list