[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Feb 23 11:21:16 PST 2006



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.52 -> 1.53
---
Log message:

Record all of the expanded registers in the DAG and machine instr, fixing
several bugs in inline asm expanded operands.


---
Diffs of the changes:  (+12 -5)

 AsmPrinter.cpp |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.52 llvm/lib/CodeGen/AsmPrinter.cpp:1.53
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.52	Wed Feb  8 22:46:04 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Thu Feb 23 13:21:04 2006
@@ -569,19 +569,26 @@
         exit(1);
       }
       
-      char ExtraCode = 0;  // FIXME:
-      
-      // Okay, we finally have an operand number.  Ask the target to print this
+      // Okay, we finally have a value number.  Ask the target to print this
       // operand!
-      if (CurVariant == -1 || CurVariant == AsmPrinterVariant)
+      if (CurVariant == -1 || CurVariant == AsmPrinterVariant) {
+        unsigned OpNo = 1;
+        
+        // Scan to find the machine operand number for the operand.
+        for (; Val; --Val)
+          OpNo += MI->getOperand(OpNo).getImmedValue()+1;
+        
+        ++OpNo;  // Skip over the ID number.
+        
         if (const_cast<AsmPrinter*>(this)->
-                PrintAsmOperand(MI, Val+1, AsmPrinterVariant,
+                PrintAsmOperand(MI, OpNo, AsmPrinterVariant,
                                 Modifier[0] ? Modifier : 0)) {
           std::cerr << "Invalid operand found in inline asm: '"
                     << AsmStr << "'\n";
           MI->dump();
           exit(1);
         }
+      }
       break;
     }
     case '{':






More information about the llvm-commits mailing list