Print variable scope name in DEBUG_VALUE comment. Useful in some cases. e.g.
authorDevang Patel <dpatel@apple.com>
Thu, 29 Apr 2010 18:52:10 +0000 (18:52 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 29 Apr 2010 18:52:10 +0000 (18:52 +0000)
##DEBUG_VALUE: runOnMachineFunction:this <- RDI+0
##DEBUG_VALUE: runOnMachineFunction:fn <- RSI+0
##DEBUG_VALUE: DeadDefs <- undef ## SimpleRegisterCoalescing.cpp:2706
##DEBUG_VALUE: getRegInfo:this <- [%rsp+$56]+$0
##DEBUG_VALUE: getTarget:this <- [%rsp+$56]+$0

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

lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86MCInstLower.cpp

index a694033fa1d3a95f036d7a88f601a7838dd33238..2c92de82d862e1dcd21dc392f93e3c71a9ed43e3 100644 (file)
@@ -502,6 +502,8 @@ static bool EmitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
 
   // cast away const; DIetc do not take const operands for some reason.
   DIVariable V(const_cast<MDNode*>(MI->getOperand(2).getMetadata()));
+  if (V.getContext().isSubprogram())
+    OS << DISubprogram(V.getContext().getNode()).getDisplayName() << ":";
   OS << V.getName() << " <- ";
 
   // Register or immediate value. Register 0 means undef.
index 32d5ceeecd31bcb0caa87e4a64427ecb11a0ba36..effc8ed38116ed7de91869ceffd8a103bcf5c486 100644 (file)
@@ -345,6 +345,8 @@ void X86AsmPrinter::PrintDebugValueComment(const MachineInstr *MI,
   O << '\t' << MAI->getCommentString() << "DEBUG_VALUE: ";
   // cast away const; DIetc do not take const operands for some reason.
   DIVariable V(const_cast<MDNode *>(MI->getOperand(NOps-1).getMetadata()));
+  if (V.getContext().isSubprogram())
+    O << DISubprogram(V.getContext().getNode()).getDisplayName() << ":";
   O << V.getName();
   O << " <- ";
   // Frame address.  Currently handles register +- offset only.