Use the PrintAsmMemoryOperand to print addressing modes.
authorChris Lattner <sabre@nondot.org>
Fri, 24 Feb 2006 20:21:58 +0000 (20:21 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 24 Feb 2006 20:21:58 +0000 (20:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26364 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter.cpp

index dceaced12f902b60b7f724ce8070d3a32e9fc2a0..92a2d7ba8dc4529ded06fe1dbbc53c1eb6e14b5b 100644 (file)
@@ -580,11 +580,19 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
           OpNo += (OpFlags >> 3) + 1;
         }
         
+        unsigned OpFlags = MI->getOperand(OpNo).getImmedValue();
         ++OpNo;  // Skip over the ID number.
-        
-        if (const_cast<AsmPrinter*>(this)->
-                PrintAsmOperand(MI, OpNo, AsmPrinterVariant,
-                                Modifier[0] ? Modifier : 0)) {
+
+        bool Error;
+        AsmPrinter *AP = const_cast<AsmPrinter*>(this);
+        if ((OpFlags & 7) == 4 /*ADDR MODE*/) {
+          Error = AP->PrintAsmMemoryOperand(MI, OpNo, AsmPrinterVariant,
+                                            Modifier[0] ? Modifier : 0);
+        } else {
+          Error = AP->PrintAsmOperand(MI, OpNo, AsmPrinterVariant,
+                                      Modifier[0] ? Modifier : 0);
+        }
+        if (Error) {
           std::cerr << "Invalid operand found in inline asm: '"
                     << AsmStr << "'\n";
           MI->dump();
@@ -633,3 +641,10 @@ bool AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
   // Target doesn't support this yet!
   return true;
 }
+
+bool AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
+                                       unsigned AsmVariant,
+                                       const char *ExtraCode) {
+  // Target doesn't support this yet!
+  return true;
+}