Pretty print DBG_VALUE machine instructions.
authorEvan Cheng <evan.cheng@apple.com>
Wed, 28 Apr 2010 20:03:13 +0000 (20:03 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Wed, 28 Apr 2010 20:03:13 +0000 (20:03 +0000)
Before:
DBG_VALUE %RSI, 0, !-1; dbg:SimpleRegisterCoalescing.cpp:2707
Now:
DBG_VALUE %RSI, 0, !"this"; dbg:SimpleRegisterCoalescing.cpp:2707

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102518 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineInstr.cpp

index 9f855d9db285bd1a6f4a85951e6f147aa21e5d0d..99b5beb136567599df88ee1134997c7bd6acf977 100644 (file)
@@ -1187,7 +1187,15 @@ void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM) const {
       if (TOI.isOptionalDef())
         OS << "opt:";
     }
-    MO.print(OS, TM);
+    if (isDebugValue() && MO.isMetadata()) {
+      // Pretty print DBG_VALUE instructions.
+      const MDNode *MD = MO.getMetadata();
+      if (const MDString *MDS = dyn_cast<MDString>(MD->getOperand(2)))
+        OS << "!\"" << MDS->getString() << '\"';
+      else
+        MO.print(OS, TM);
+    } else
+      MO.print(OS, TM);
   }
 
   // Briefly indicate whether any call clobbers were omitted.