summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-05-12 23:53:03 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-05-12 23:53:03 +0000
commit290e22872d8c923395c6eba39b64255692d6b41d (patch)
treefdfd217b4674d8791b4507993edf32c72ec683d5 /llvm/lib
parent7fd1d725b96ee4a2778a6c3661a4df903dbd2483 (diff)
downloadbcm5719-llvm-290e22872d8c923395c6eba39b64255692d6b41d.tar.gz
bcm5719-llvm-290e22872d8c923395c6eba39b64255692d6b41d.zip
Revert "DebugInfo: Include lexical scopes in inlined subroutines."
This reverts commit r208506. Some inlined subroutine scopes appear to be missing with this change. Reverting while I investigate. llvm-svn: 208642
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp12
-rw-r--r--llvm/lib/CodeGen/LexicalScopes.cpp40
2 files changed, 17 insertions, 35 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index bbd00eab7f7..ed8360f2054 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -623,7 +623,7 @@ std::unique_ptr<DIE> DwarfDebug::constructScopeDIE(DwarfCompileUnit &TheCU,
// avoid creating un-used children then removing them later when we find out
// the scope DIE is null.
std::unique_ptr<DIE> ScopeDIE;
- if (DS.getContext() && DS.isSubprogram()) {
+ if (Scope->getInlinedAt()) {
ScopeDIE = constructInlinedScopeDIE(TheCU, Scope);
if (!ScopeDIE)
return nullptr;
@@ -1210,12 +1210,10 @@ DwarfDebug::collectVariableInfo(SmallPtrSet<const MDNode *, 16> &Processed) {
if (DV.getTag() == dwarf::DW_TAG_arg_variable &&
DISubprogram(DV.getContext()).describes(CurFn->getFunction()))
Scope = LScopes.getCurrentFunctionScope();
- else if (MDNode *IA = DV.getInlinedAt()) {
- DebugLoc DL = DebugLoc::getFromDILocation(IA);
- Scope = LScopes.findInlinedScope(DebugLoc::get(
- DL.getLine(), DL.getCol(), DV.getContext(), IA));
- } else
- Scope = LScopes.findLexicalScope(DV.getContext());
+ else if (MDNode *IA = DV.getInlinedAt())
+ Scope = LScopes.findInlinedScope(DebugLoc::getFromDILocation(IA));
+ else
+ Scope = LScopes.findLexicalScope(cast<MDNode>(DV->getOperand(1)));
// If variable scope is not found then skip this variable.
if (!Scope)
continue;
diff --git a/llvm/lib/CodeGen/LexicalScopes.cpp b/llvm/lib/CodeGen/LexicalScopes.cpp
index 8bf69ff6308..46f864ca55d 100644
--- a/llvm/lib/CodeGen/LexicalScopes.cpp
+++ b/llvm/lib/CodeGen/LexicalScopes.cpp
@@ -104,14 +104,6 @@ void LexicalScopes::extractLexicalScopes(
}
}
-LexicalScope *LexicalScopes::findInlinedScope(DebugLoc DL) {
- MDNode *Scope = nullptr;
- MDNode *IA = nullptr;
- DL.getScopeAndInlinedAt(Scope, IA, MF->getFunction()->getContext());
- auto I = InlinedLexicalScopeMap.find(std::make_pair(Scope, IA));
- return I != InlinedLexicalScopeMap.end() ? &I->second : nullptr;
-}
-
/// findLexicalScope - Find lexical scope, either regular or inlined, for the
/// given DebugLoc. Return NULL if not found.
LexicalScope *LexicalScopes::findLexicalScope(DebugLoc DL) {
@@ -127,10 +119,8 @@ LexicalScope *LexicalScopes::findLexicalScope(DebugLoc DL) {
if (D.isLexicalBlockFile())
Scope = DILexicalBlockFile(Scope).getScope();
- if (IA) {
- auto I = InlinedLexicalScopeMap.find(std::make_pair(Scope, IA));
- return I != InlinedLexicalScopeMap.end() ? &I->second : nullptr;
- }
+ if (IA)
+ return InlinedLexicalScopeMap.lookup(DebugLoc::getFromDILocation(IA));
return findLexicalScope(Scope);
}
@@ -180,27 +170,21 @@ LexicalScope *LexicalScopes::getOrCreateRegularScope(MDNode *Scope) {
}
/// getOrCreateInlinedScope - Find or create an inlined lexical scope.
-LexicalScope *LexicalScopes::getOrCreateInlinedScope(MDNode *ScopeNode,
+LexicalScope *LexicalScopes::getOrCreateInlinedScope(MDNode *Scope,
MDNode *InlinedAt) {
- std::pair<const MDNode*, const MDNode*> P(ScopeNode, InlinedAt);
- auto I = InlinedLexicalScopeMap.find(P);
- if (I != InlinedLexicalScopeMap.end())
+ auto I = LexicalScopeMap.find(InlinedAt);
+ if (I != LexicalScopeMap.end())
return &I->second;
- LexicalScope *Parent;
- DILexicalBlock Scope(ScopeNode);
- if (Scope.isLexicalBlock()) {
- DILexicalBlock PB(Scope.getContext());
- Parent = getOrCreateInlinedScope(PB, InlinedAt);
- } else
- Parent = getOrCreateLexicalScope(DebugLoc::getFromDILocation(InlinedAt));
-
+ DebugLoc InlinedLoc = DebugLoc::getFromDILocation(InlinedAt);
// FIXME: Use forward_as_tuple instead of make_tuple, once MSVC2012
// compatibility is no longer required.
- I = InlinedLexicalScopeMap.emplace(std::piecewise_construct,
- std::make_tuple(P),
- std::make_tuple(Parent, Scope, InlinedAt,
- false)).first;
+ I = LexicalScopeMap.emplace(
+ std::piecewise_construct, std::make_tuple(InlinedAt),
+ std::make_tuple(getOrCreateLexicalScope(InlinedLoc),
+ DIDescriptor(Scope), InlinedAt,
+ false)).first;
+ InlinedLexicalScopeMap[InlinedLoc] = &I->second;
return &I->second;
}
OpenPOWER on IntegriCloud