diff options
author | Igor Kudrin <ikudrin@accesssoftek.com> | 2019-02-26 12:15:14 +0000 |
---|---|---|
committer | Igor Kudrin <ikudrin@accesssoftek.com> | 2019-02-26 12:15:14 +0000 |
commit | 2d3faad706c81814abc5e4080df38c4bccde1d48 (patch) | |
tree | 9a11b749881378558b3eabd238ac516e787b8b01 /llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp | |
parent | e42be1eae230d0ff3f650fcea7826da4842e7371 (diff) | |
download | bcm5719-llvm-2d3faad706c81814abc5e4080df38c4bccde1d48.tar.gz bcm5719-llvm-2d3faad706c81814abc5e4080df38c4bccde1d48.zip |
[llvm-objdump] Implement -Mreg-names-raw/-std options.
The --disassembler-options, or -M, are used to customize
the disassembler and affect its output.
The two implemented options allow selecting register names on ARM:
* With -Mreg-names-raw, the disassembler uses rNN for all registers.
* With -Mreg-names-std it prints sp, lr and pc for r13, r14 and r15,
which is the default behavior of llvm-objdump.
Differential Revision: https://reviews.llvm.org/D57680
llvm-svn: 354870
Diffstat (limited to 'llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp b/llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp index ee909f46af2..ec5fd16cd7d 100644 --- a/llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp +++ b/llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp @@ -72,8 +72,20 @@ ARMInstPrinter::ARMInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI) : MCInstPrinter(MAI, MII, MRI) {} +bool ARMInstPrinter::applyTargetSpecificCLOption(StringRef Opt) { + if (Opt == "reg-names-std") { + DefaultAltIdx = ARM::NoRegAltName; + return true; + } + if (Opt == "reg-names-raw") { + DefaultAltIdx = ARM::RegNamesRaw; + return true; + } + return false; +} + void ARMInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const { - OS << markup("<reg:") << getRegisterName(RegNo) << markup(">"); + OS << markup("<reg:") << getRegisterName(RegNo, DefaultAltIdx) << markup(">"); } void ARMInstPrinter::printInst(const MCInst *MI, raw_ostream &O, |