[llvm-commits] [llvm] r162910 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Aug 30 07:39:06 PDT 2012


Author: stoklund
Date: Thu Aug 30 09:39:06 2012
New Revision: 162910

URL: http://llvm.org/viewvc/llvm-project?rev=162910&view=rev
Log:
Don't use MCInstrDesc flags for implicit operands.

When a MachineInstr is constructed, its implicit operands are added
first, then the explicit operands are inserted before the implicits.

MCInstrDesc has oprand flags like early clobber and operand ties that
apply to the explicit operands.

Don't look at those flags when the implicit operands are first added in
the explicit operands's positions.

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

Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=162910&r1=162909&r2=162910&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Thu Aug 30 09:39:06 2012
@@ -721,19 +721,24 @@
     // Add the new operand to RegInfo.
     if (RegInfo)
       RegInfo->addRegOperandToUseList(&Operands[OpNo]);
-    // Set the IsTied bit if MC indicates this use is tied to a def.
-    if (Operands[OpNo].isUse()) {
-      int DefIdx = MCID->getOperandConstraint(OpNo, MCOI::TIED_TO);
-      if (DefIdx != -1) {
-        MachineOperand &DefMO = getOperand(DefIdx);
-        assert(DefMO.isDef() && "Use tied to operand that isn't a def");
-        DefMO.IsTied = true;
-        Operands[OpNo].IsTied = true;
+    // The MCID operand information isn't accurate until we start adding
+    // explicit operands. The implicit operands are added first, then the
+    // explicits are inserted before them.
+    if (!isImpReg) {
+      // Set the IsTied bit if MC indicates this use is tied to a def.
+      if (Operands[OpNo].isUse()) {
+        int DefIdx = MCID->getOperandConstraint(OpNo, MCOI::TIED_TO);
+        if (DefIdx != -1) {
+          MachineOperand &DefMO = getOperand(DefIdx);
+          assert(DefMO.isDef() && "Use tied to operand that isn't a def");
+          DefMO.IsTied = true;
+          Operands[OpNo].IsTied = true;
+        }
       }
+      // If the register operand is flagged as early, mark the operand as such.
+      if (MCID->getOperandConstraint(OpNo, MCOI::EARLY_CLOBBER) != -1)
+        Operands[OpNo].setIsEarlyClobber(true);
     }
-    // If the register operand is flagged as early, mark the operand as such.
-    if (MCID->getOperandConstraint(OpNo, MCOI::EARLY_CLOBBER) != -1)
-      Operands[OpNo].setIsEarlyClobber(true);
   }
 
   // Re-add all the implicit ops.





More information about the llvm-commits mailing list