diff options
author | Kevin Enderby <enderby@apple.com> | 2012-12-05 18:13:19 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2012-12-05 18:13:19 +0000 |
commit | 14ccc9007a932a23201251ced4be4c898a62d6a5 (patch) | |
tree | e77baa1da1529b24ea4f7cc4a0b451b9481b8724 /lib/Target/ARM/InstPrinter | |
parent | d1abec365aa89a8497d9b615ccb4b21c72da9447 (diff) | |
download | external_llvm-14ccc9007a932a23201251ced4be4c898a62d6a5.zip external_llvm-14ccc9007a932a23201251ced4be4c898a62d6a5.tar.gz external_llvm-14ccc9007a932a23201251ced4be4c898a62d6a5.tar.bz2 |
Added a option to the disassembler to print immediates as hex.
This is for the lldb team so most of but not all of the values are
to be printed as hex with this option. Some small values like the
scale in an X86 address were requested to printed in decimal
without the leading 0x.
There may be some tweaks need to places that may still be in
decimal that they want in hex. Specially for arm. I made my best
guess. Any tweaks from here should be simple.
I also did the best I know now with help from the C++ gurus
creating the cleanest formatImm() utility function and containing
the changes. But if someone has a better idea to make something
cleaner I'm all ears and game for changing the implementation.
rdar://8109283
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169393 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/InstPrinter')
-rw-r--r-- | lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp b/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp index b9f21dc..d48b37e 100644 --- a/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp +++ b/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp @@ -293,7 +293,7 @@ void ARMInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, printRegName(O, Reg); } else if (Op.isImm()) { O << markup("<imm:") - << '#' << Op.getImm() + << '#' << formatImm(Op.getImm()) << markup(">"); } else { assert(Op.isExpr() && "unknown operand kind in printOperand"); @@ -319,7 +319,7 @@ void ARMInstPrinter::printThumbLdrLabelOperand(const MCInst *MI, unsigned OpNum, O << *MO1.getExpr(); else if (MO1.isImm()) { O << markup("<mem:") << "[pc, " - << markup("<imm:") << "#" << MO1.getImm() + << markup("<imm:") << "#" << formatImm(MO1.getImm()) << markup(">]>", "]"); } else @@ -911,7 +911,7 @@ void ARMInstPrinter::printAdrLabelOperand(const MCInst *MI, unsigned OpNum, void ARMInstPrinter::printThumbS4ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O) { O << markup("<imm:") - << "#" << MI->getOperand(OpNum).getImm() * 4 + << "#" << formatImm(MI->getOperand(OpNum).getImm() * 4) << markup(">"); } @@ -919,7 +919,7 @@ void ARMInstPrinter::printThumbSRImm(const MCInst *MI, unsigned OpNum, raw_ostream &O) { unsigned Imm = MI->getOperand(OpNum).getImm(); O << markup("<imm:") - << "#" << (Imm == 0 ? 32 : Imm) + << "#" << formatImm((Imm == 0 ? 32 : Imm)) << markup(">"); } @@ -976,7 +976,7 @@ void ARMInstPrinter::printThumbAddrModeImm5SOperand(const MCInst *MI, if (unsigned ImmOffs = MO2.getImm()) { O << ", " << markup("<imm:") - << "#" << ImmOffs * Scale + << "#" << formatImm(ImmOffs * Scale) << markup(">"); } O << "]" << markup(">"); @@ -1127,7 +1127,7 @@ void ARMInstPrinter::printT2AddrModeImm0_1020s4Operand(const MCInst *MI, if (MO2.getImm()) { O << ", " << markup("<imm:") - << "#" << MO2.getImm() * 4 + << "#" << formatImm(MO2.getImm() * 4) << markup(">"); } O << "]" << markup(">"); @@ -1217,7 +1217,7 @@ void ARMInstPrinter::printImmPlusOneOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O) { unsigned Imm = MI->getOperand(OpNum).getImm(); O << markup("<imm:") - << "#" << Imm + 1 + << "#" << formatImm(Imm + 1) << markup(">"); } |