Add X86 instruction printer support for printing MCValue operands.

llvm-svn: 78984
This commit is contained in:
Daniel Dunbar 2009-08-14 03:42:12 +00:00
parent 259bc4b0e7
commit b0adbe646d

View 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() ||