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/Target/ARM/AsmParser/ARMAsmParser.cpp | |
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/Target/ARM/AsmParser/ARMAsmParser.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index a2883191178..203da11ed32 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -9310,6 +9310,10 @@ bool ARMAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, switch (MatchResult) { case Match_Success: + LLVM_DEBUG(dbgs() << "Parsed as: "; + Inst.dump_pretty(dbgs(), MII.getName(Inst.getOpcode())); + dbgs() << "\n"); + // Context sensitive operand constraints aren't handled by the matcher, // so check them here. if (validateInstruction(Inst, Operands)) { @@ -9327,7 +9331,9 @@ bool ARMAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, // individual transformations can chain off each other. E.g., // tPOP(r8)->t2LDMIA_UPD(sp,r8)->t2STR_POST(sp,r8) while (processInstruction(Inst, Operands, Out)) - ; + LLVM_DEBUG(dbgs() << "Changed to: "; + Inst.dump_pretty(dbgs(), MII.getName(Inst.getOpcode())); + dbgs() << "\n"); // Only after the instruction is fully processed, we can validate it if (wasInITBlock && hasV8Ops() && isThumb() && |