[PATCH] D54852: [ARM][Asm] Debug trace for the processInstruction loop

Oliver Stannard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 3 02:24:34 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL348113: [ARM][Asm] Debug trace for the processInstruction loop (authored by olista01, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D54852?vs=175107&id=176329#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54852/new/

https://reviews.llvm.org/D54852

Files:
  llvm/trunk/include/llvm/MC/MCInst.h
  llvm/trunk/lib/MC/MCInst.cpp
  llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp


Index: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -9310,6 +9310,10 @@
 
   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 @@
       // 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() &&
Index: llvm/trunk/lib/MC/MCInst.cpp
===================================================================
--- llvm/trunk/lib/MC/MCInst.cpp
+++ llvm/trunk/lib/MC/MCInst.cpp
@@ -72,11 +72,17 @@
 
 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;
Index: llvm/trunk/include/llvm/MC/MCInst.h
===================================================================
--- llvm/trunk/include/llvm/MC/MCInst.h
+++ llvm/trunk/include/llvm/MC/MCInst.h
@@ -208,6 +208,8 @@
   /// string.
   void dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer = nullptr,
                    StringRef Separator = " ") const;
+  void dump_pretty(raw_ostream &OS, StringRef Name,
+                   StringRef Separator = " ") const;
 };
 
 inline raw_ostream& operator<<(raw_ostream &OS, const MCOperand &MO) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54852.176329.patch
Type: text/x-patch
Size: 2589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181203/d606451c/attachment.bin>


More information about the llvm-commits mailing list