Add X86 instruction printer support for printing MCValue operands.
authorDaniel Dunbar <daniel@zuster.org>
Fri, 14 Aug 2009 03:42:12 +0000 (03:42 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 14 Aug 2009 03:42:12 +0000 (03:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78984 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp

index 34908dae298ab9b281050965b9ffd8426b3ae1bf..52950aa323b4afdafebbcc90fe086997c4ac89da 100644 (file)
@@ -55,6 +55,8 @@ void X86ATTAsmPrinter::print_pcrel_imm(const MCInst *MI, unsigned OpNo) {
   
   if (Op.isImm())
     O << Op.getImm();
+  else if (Op.isMCValue())
+    Op.getMCValue().print(O);
   else if (Op.isMBBLabel())
     // FIXME: Keep in sync with printBasicBlockLabel.  printBasicBlockLabel
     // should eventually call into this code, not the other way around.
@@ -88,6 +90,10 @@ void X86ATTAsmPrinter::printOperand(const MCInst *MI, unsigned OpNo,
     O << '$';
     O << Op.getImm();
     return;
+  } else if (Op.isMCValue()) {
+    O << '$';
+    Op.getMCValue().print(O);
+    return;
   }
   
   O << "<<UNKNOWN OPERAND KIND>>";
@@ -103,6 +109,8 @@ void X86ATTAsmPrinter::printLeaMemReference(const MCInst *MI, unsigned Op) {
     int64_t DispVal = DispSpec.getImm();
     if (DispVal || (!IndexReg.getReg() && !BaseReg.getReg()))
       O << DispVal;
+  } else if (DispSpec.isMCValue()) {
+    DispSpec.getMCValue().print(O);
   } else {
     llvm_unreachable("non-immediate displacement for LEA?");
     //assert(DispSpec.isGlobal() || DispSpec.isCPI() ||