diff options
| author | Oliver Stannard <oliver.stannard@arm.com> | 2018-12-03 10:21:28 +0000 |
|---|---|---|
| committer | Oliver Stannard <oliver.stannard@arm.com> | 2018-12-03 10:21:28 +0000 |
| commit | c588110f1340d997fb18f4fbbc7d363dc150cd71 (patch) | |
| tree | 70e6436caba15fd1efd9d79687680557c54e46f4 /llvm/lib/MC | |
| parent | 7502e5fc560dcb59f7c3aaf40960a7b5451c5a1e (diff) | |
| download | bcm5719-llvm-c588110f1340d997fb18f4fbbc7d363dc150cd71.tar.gz bcm5719-llvm-c588110f1340d997fb18f4fbbc7d363dc150cd71.zip | |
[ARM][Asm] Debug trace for the processInstruction loop
In the Arm assembly parser, we first match an instruction, then call
processInstruction to possibly change it to a different encoding, to
match rules in the architecture manual which can't be expressed by the
table-generated matcher.
This adds debug printing so that this process is visible when using the
-debug option.
To support this, I've added a new overload of MCInst::dump_pretty which
takes the opcode name as a StringRef, since we don't have an InstPrinter
instance in the assembly parser. Instead, we can get the same
information directly from the MCInstrInfo.
Differential revision: https://reviews.llvm.org/D54852
llvm-svn: 348113
Diffstat (limited to 'llvm/lib/MC')
| -rw-r--r-- | llvm/lib/MC/MCInst.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCInst.cpp b/llvm/lib/MC/MCInst.cpp index f9b71caaf91..64f111fc711 100644 --- a/llvm/lib/MC/MCInst.cpp +++ b/llvm/lib/MC/MCInst.cpp @@ -72,11 +72,17 @@ void MCInst::print(raw_ostream &OS) const { void MCInst::dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer, StringRef Separator) const { + StringRef InstName = Printer ? Printer->getOpcodeName(getOpcode()) : ""; + dump_pretty(OS, InstName, Separator); +} + +void MCInst::dump_pretty(raw_ostream &OS, StringRef Name, + StringRef Separator) const { OS << "<MCInst #" << getOpcode(); - // Show the instruction opcode name if we have access to a printer. - if (Printer) - OS << ' ' << Printer->getOpcodeName(getOpcode()); + // Show the instruction opcode name if we have it. + if (!Name.empty()) + OS << ' ' << Name; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { OS << Separator; |

