diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.h b/llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.h --- a/llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.h +++ b/llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.h @@ -117,6 +117,7 @@ private: bool HasCustomInstComment; + void printMarkedUpRegName(raw_ostream &OS, unsigned RegNo); }; } // end namespace llvm diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.cpp --- a/llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.cpp @@ -35,7 +35,7 @@ #include "X86GenAsmWriter.inc" void X86ATTInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const { - OS << markup(""); + withMarkup(OS, MarkupType::Reg) << '%' << getRegisterName(RegNo); } void X86ATTInstPrinter::printInst(const MCInst *MI, raw_ostream &OS, @@ -357,7 +357,7 @@ } else if (Op.isImm()) { // Print immediates as signed values. int64_t Imm = Op.getImm(); - O << markup(""); + withMarkup(O, MarkupType::Imm) << '$' << formatImm(Imm); // TODO: This should be in a helper function in the base class, so it can // be used by other printers. @@ -376,9 +376,9 @@ } } else { assert(Op.isExpr() && "unknown operand kind in printOperand"); - O << markup("print(O, &MAI); - O << markup(">"); + O << endMarkup(); } } @@ -388,7 +388,7 @@ const MCOperand &IndexReg = MI->getOperand(Op + X86::AddrIndexReg); const MCOperand &DispSpec = MI->getOperand(Op + X86::AddrDisp); - O << markup("getOperand(Op + X86::AddrScaleAmt).getImm(); if (ScaleVal != 1) { - O << ',' << markup(""); + O << ','; + withMarkup(O, MarkupType::Imm) << ScaleVal; // never printed in hex. } } O << ')'; } - O << markup(">"); + O << endMarkup(); } void X86ATTInstPrinter::printSrcIdx(const MCInst *MI, unsigned Op, raw_ostream &O) { - O << markup(""); + O << endMarkup(); } void X86ATTInstPrinter::printDstIdx(const MCInst *MI, unsigned Op, raw_ostream &O) { - O << markup(""); + O << endMarkup(); } void X86ATTInstPrinter::printMemOffset(const MCInst *MI, unsigned Op, raw_ostream &O) { const MCOperand &DispSpec = MI->getOperand(Op); - O << markup("print(O, &MAI); } - O << markup(">"); + O << endMarkup(); } void X86ATTInstPrinter::printU8Imm(const MCInst *MI, unsigned Op, @@ -471,8 +471,8 @@ if (MI->getOperand(Op).isExpr()) return printOperand(MI, Op, O); - O << markup("getOperand(Op).getImm() & 0xff) - << markup(">"); + withMarkup(O, MarkupType::Imm) << '$' + << formatImm(MI->getOperand(Op).getImm() & 0xff); } void X86ATTInstPrinter::printSTiRegOperand(const MCInst *MI, unsigned OpNo, @@ -481,7 +481,7 @@ unsigned Reg = Op.getReg(); // Override the default printing to print st(0) instead st. if (Reg == X86::ST0) - OS << markup(""); + withMarkup(OS, MarkupType::Reg) << "%st(0)"; else printRegName(OS, Reg); }