diff options
author | Daniel Malea <daniel.malea@intel.com> | 2013-08-01 21:18:16 +0000 |
---|---|---|
committer | Daniel Malea <daniel.malea@intel.com> | 2013-08-01 21:18:16 +0000 |
commit | a3d4245a72ac73a7b059ca8ef1bc01c25f860b6f (patch) | |
tree | ac83f96c200195aa4890788e0e66b1a18e52761c /llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp | |
parent | 83f879ddb240ef09e5dc5dd14d2918b0ba5ad55b (diff) | |
download | bcm5719-llvm-a3d4245a72ac73a7b059ca8ef1bc01c25f860b6f.tar.gz bcm5719-llvm-a3d4245a72ac73a7b059ca8ef1bc01c25f860b6f.zip |
Fixed the Intel-syntax X86 disassembler to respect the (existing) option for hexadecimal immediates, to match AT&T syntax. This also brings a new option for C-vs-MASM-style hex.
Patch by Richard Mitton
Reviewed: http://llvm-reviews.chandlerc.com/D1243
llvm-svn: 187614
Diffstat (limited to 'llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp b/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp index 6f66db9f8d3..9dfc9a9aa74 100644 --- a/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp +++ b/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp @@ -119,7 +119,7 @@ void X86IntelInstPrinter::printPCRelImm(const MCInst *MI, unsigned OpNo, raw_ostream &O) { const MCOperand &Op = MI->getOperand(OpNo); if (Op.isImm()) - O << Op.getImm(); + O << formatImm(Op.getImm()); else { assert(Op.isExpr() && "unknown pcrel immediate operand"); // If a symbolic branch target was added as a constant expression then print @@ -127,8 +127,7 @@ void X86IntelInstPrinter::printPCRelImm(const MCInst *MI, unsigned OpNo, const MCConstantExpr *BranchTarget = dyn_cast<MCConstantExpr>(Op.getExpr()); int64_t Address; if (BranchTarget && BranchTarget->EvaluateAsAbsolute(Address)) { - O << "0x"; - O.write_hex(Address); + O << formatHex((uint64_t)Address); } else { // Otherwise, just print the expression. @@ -143,7 +142,7 @@ void X86IntelInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, if (Op.isReg()) { printRegName(O, Op.getReg()); } else if (Op.isImm()) { - O << Op.getImm(); + O << formatImm((int64_t)Op.getImm()); } else { assert(Op.isExpr() && "unknown operand kind in printOperand"); O << *Op.getExpr(); @@ -195,7 +194,7 @@ void X86IntelInstPrinter::printMemReference(const MCInst *MI, unsigned Op, DispVal = -DispVal; } } - O << DispVal; + O << formatImm(DispVal); } } |