Index: llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp =================================================================== --- llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp +++ llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp @@ -320,6 +320,7 @@ const MCOperand &Op = MI->getOperand(OpNo); if (Op.isImm()) { + O << markup(""); } else { assert(Op.isExpr() && "unknown pcrel immediate operand"); // If a symbolic branch target was added as a constant expression then print @@ -334,7 +336,7 @@ const MCConstantExpr *BranchTarget = dyn_cast(Op.getExpr()); int64_t Address; if (BranchTarget && BranchTarget->evaluateAsAbsolute(Address)) { - O << formatHex((uint64_t)Address); + O << markup(""); } else { // Otherwise, just print the expression. Op.getExpr()->print(O, &MAI); Index: llvm/lib/Target/X86/MCTargetDesc/X86IntelInstPrinter.cpp =================================================================== --- llvm/lib/Target/X86/MCTargetDesc/X86IntelInstPrinter.cpp +++ llvm/lib/Target/X86/MCTargetDesc/X86IntelInstPrinter.cpp @@ -34,7 +34,7 @@ #include "X86GenAsmWriter1.inc" void X86IntelInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const { - OS << getRegisterName(RegNo); + OS << markup(""); } void X86IntelInstPrinter::printInst(const MCInst *MI, uint64_t Address, @@ -361,7 +361,7 @@ if (Op.isReg()) { printRegName(O, Op.getReg()); } else if (Op.isImm()) { - O << formatImm((int64_t)Op.getImm()); + O << markup(""); } else { assert(Op.isExpr() && "unknown operand kind in printOperand"); O << "offset "; @@ -388,7 +388,7 @@ // If this has a segment register, print it. printOptionalSegReg(MI, Op + X86::AddrSegmentReg, O); - O << '['; + O << markup(""); } } - O << ']'; + O << ']' << markup(">"); } void X86IntelInstPrinter::printSrcIdx(const MCInst *MI, unsigned Op, raw_ostream &O) { // If this has a segment register, print it. printOptionalSegReg(MI, Op + 1, O); - O << '['; + O << markup(""); } void X86IntelInstPrinter::printDstIdx(const MCInst *MI, unsigned Op, raw_ostream &O) { // DI accesses are always ES-based. - O << "es:["; + O << "es:" << markup(""); } void X86IntelInstPrinter::printMemOffset(const MCInst *MI, unsigned Op, @@ -450,16 +450,16 @@ // If this has a segment register, print it. printOptionalSegReg(MI, Op + 1, O); - O << '['; + O << markup(""); } else { assert(DispSpec.isExpr() && "non-immediate displacement?"); DispSpec.getExpr()->print(O, &MAI); } - O << ']'; + O << ']' << markup(">"); } void X86IntelInstPrinter::printU8Imm(const MCInst *MI, unsigned Op, @@ -467,7 +467,8 @@ if (MI->getOperand(Op).isExpr()) return MI->getOperand(Op).getExpr()->print(O, &MAI); - O << formatImm(MI->getOperand(Op).getImm() & 0xff); + O << markup("getOperand(Op).getImm() & 0xff) + << markup(">"); } void X86IntelInstPrinter::printSTiRegOperand(const MCInst *MI, unsigned OpNo, Index: llvm/test/MC/Disassembler/X86/marked-up-i386.txt =================================================================== --- /dev/null +++ llvm/test/MC/Disassembler/X86/marked-up-i386.txt @@ -0,0 +1,7 @@ +# RUN: llvm-mc --mdis %s -triple=i386-apple-darwin9 2>&1 | FileCheck %s + +# CHECK: je +0x0f 0x84 0x3c 0x00 0x00 0x00 +# CHECK: jecxz +0xe3 0x81 +