aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-04-29 18:52:10 +0000
committerDevang Patel <dpatel@apple.com>2010-04-29 18:52:10 +0000
commit67a444ca362b6f2dc64016494eb1165d46aef0bf (patch)
treece6fdd059c58fa07f86acd0faa89ea5a147720fe
parentbd6cb4ba1f743f840da844b44aa0ec92e56777ee (diff)
downloadexternal_llvm-67a444ca362b6f2dc64016494eb1165d46aef0bf.zip
external_llvm-67a444ca362b6f2dc64016494eb1165d46aef0bf.tar.gz
external_llvm-67a444ca362b6f2dc64016494eb1165d46aef0bf.tar.bz2
Print variable scope name in DEBUG_VALUE comment. Useful in some cases. e.g.
##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
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp2
-rw-r--r--lib/Target/X86/AsmPrinter/X86MCInstLower.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index a694033..2c92de8 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -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.
diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
index 32d5cee..effc8ed 100644
--- a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
+++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
@@ -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.