Fix minor bug in previous checkin
authorChris Lattner <sabre@nondot.org>
Wed, 11 Aug 2004 04:08:36 +0000 (04:08 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 11 Aug 2004 04:08:36 +0000 (04:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15649 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/AsmWriterEmitter.cpp

index faecc9fdc6d16666e96c578a50a374856183f33b..b2e2125f82afdd2f6f0bde69426f92b405f4d1a0 100644 (file)
@@ -75,15 +75,16 @@ void AsmWriterEmitter::run(std::ostream &O) {
 
           // If this is a two-address instruction and we are not accessing the
           // 0th operand, remove an operand.
-          if (I->second.isTwoAddress && OpNo != 0) {
-            if (OpNo == 1)
+          unsigned MIOp = I->second.OperandList[OpNo].MIOperandNo;
+          if (I->second.isTwoAddress && MIOp != 0) {
+            if (MIOp == 1)
               throw "Should refer to operand #0 instead of #1 for two-address"
                     " instruction '" + I->first + "'!";
-            --OpNo;
+            --MIOp;
           }
 
           O << ";  " << I->second.OperandList[OpNo].PrinterMethodName 
-            << "(MI, " << I->second.OperandList[OpNo].MIOperandNo << ", MVT::"
+            << "(MI, " << MIOp << ", MVT::"
             << getName(I->second.OperandList[OpNo].Ty) << "); O ";
           LastEmitted = VarEnd;
         }