aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugVariables.cpp
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2013-02-13 01:14:49 +0000
committerManman Ren <mren@apple.com>2013-02-13 01:14:49 +0000
commitf019cd62da1834c166324a28b1a8d69e4cb47e87 (patch)
tree3d67b9e633037484e3b75167f3781a8522a03a72 /llvm/lib/CodeGen/LiveDebugVariables.cpp
parent8356d091bf5fc0cba384d33d7d37c6389b3f6efe (diff)
downloadllvm-f019cd62da1834c166324a28b1a8d69e4cb47e87.zip
llvm-f019cd62da1834c166324a28b1a8d69e4cb47e87.tar.gz
llvm-f019cd62da1834c166324a28b1a8d69e4cb47e87.tar.bz2
Debug Info: LiveDebugVarible can remove DBG_VALUEs, make sure we emit them back.
RegisterCoalescer used to depend on LiveDebugVariable. LDV removes DBG_VALUEs without emitting them at the end. We fix this by removing LDV from RegisterCoalescer. Also add an assertion to make sure we call emitDebugValues if DBG_VALUEs are removed at runOnMachineFunction. rdar://problem/13183203 Reviewed by Andy & Jakob llvm-svn: 175023
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugVariables.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugVariables.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp
index 786f353..3e31051 100644
--- a/llvm/lib/CodeGen/LiveDebugVariables.cpp
+++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp
@@ -64,7 +64,8 @@ void LiveDebugVariables::getAnalysisUsage(AnalysisUsage &AU) const {
MachineFunctionPass::getAnalysisUsage(AU);
}
-LiveDebugVariables::LiveDebugVariables() : MachineFunctionPass(ID), pImpl(0) {
+LiveDebugVariables::LiveDebugVariables() : MachineFunctionPass(ID), pImpl(0),
+ EmitDone(false), ModifiedMF(false) {
initializeLiveDebugVariablesPass(*PassRegistry::getPassRegistry());
}
@@ -701,12 +702,17 @@ bool LiveDebugVariables::runOnMachineFunction(MachineFunction &mf) {
return false;
if (!pImpl)
pImpl = new LDVImpl(this);
- return static_cast<LDVImpl*>(pImpl)->runOnMachineFunction(mf);
+ ModifiedMF = static_cast<LDVImpl*>(pImpl)->runOnMachineFunction(mf);
+ return ModifiedMF;
}
void LiveDebugVariables::releaseMemory() {
- if (pImpl)
+ if (pImpl) {
static_cast<LDVImpl*>(pImpl)->clear();
+ // Make sure we call emitDebugValues if the machine function was modified.
+ assert((!ModifiedMF || EmitDone) &&
+ "Dbg values are not emitted in LDV");
+ }
}
LiveDebugVariables::~LiveDebugVariables() {
@@ -1014,8 +1020,10 @@ void LDVImpl::emitDebugValues(VirtRegMap *VRM) {
}
void LiveDebugVariables::emitDebugValues(VirtRegMap *VRM) {
- if (pImpl)
+ if (pImpl) {
static_cast<LDVImpl*>(pImpl)->emitDebugValues(VRM);
+ EmitDone = true;
+ }
}