forked from OSchip/llvm-project
Speculatively roll back r207724-r207726, which are code cleanup changes and
appear to be breaking a bootstrapped build of compiler-rt. llvm-svn: 207732
This commit is contained in:
parent
09d5b3a928
commit
d730500706
|
@ -25,7 +25,6 @@
|
||||||
#include "llvm/IR/Metadata.h"
|
#include "llvm/IR/Metadata.h"
|
||||||
#include "llvm/IR/ValueHandle.h"
|
#include "llvm/IR/ValueHandle.h"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <memory>
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
class MachineInstr;
|
class MachineInstr;
|
||||||
|
@ -90,8 +89,7 @@ public:
|
||||||
|
|
||||||
/// findAbstractScope - Find an abstract scope or return NULL.
|
/// findAbstractScope - Find an abstract scope or return NULL.
|
||||||
LexicalScope *findAbstractScope(const MDNode *N) {
|
LexicalScope *findAbstractScope(const MDNode *N) {
|
||||||
auto I = AbstractScopeMap.find(N);
|
return AbstractScopeMap.lookup(N);
|
||||||
return I != AbstractScopeMap.end() ? I->second.get() : nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// findInlinedScope - Find an inlined scope for the given DebugLoc or return
|
/// findInlinedScope - Find an inlined scope for the given DebugLoc or return
|
||||||
|
@ -102,8 +100,7 @@ public:
|
||||||
|
|
||||||
/// findLexicalScope - Find regular lexical scope or return NULL.
|
/// findLexicalScope - Find regular lexical scope or return NULL.
|
||||||
LexicalScope *findLexicalScope(const MDNode *N) {
|
LexicalScope *findLexicalScope(const MDNode *N) {
|
||||||
auto I = LexicalScopeMap.find(N);
|
return LexicalScopeMap.lookup(N);
|
||||||
return I != LexicalScopeMap.end() ? I->second.get() : nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// dump - Print data structures to dbgs().
|
/// dump - Print data structures to dbgs().
|
||||||
|
@ -137,7 +134,7 @@ private:
|
||||||
|
|
||||||
/// LexicalScopeMap - Tracks the scopes in the current function. Owns the
|
/// LexicalScopeMap - Tracks the scopes in the current function. Owns the
|
||||||
/// contained LexicalScope*s.
|
/// contained LexicalScope*s.
|
||||||
DenseMap<const MDNode *, std::unique_ptr<LexicalScope>> LexicalScopeMap;
|
DenseMap<const MDNode *, LexicalScope *> LexicalScopeMap;
|
||||||
|
|
||||||
/// InlinedLexicalScopeMap - Tracks inlined function scopes in current
|
/// InlinedLexicalScopeMap - Tracks inlined function scopes in current
|
||||||
/// function.
|
/// function.
|
||||||
|
@ -145,7 +142,7 @@ private:
|
||||||
|
|
||||||
/// AbstractScopeMap - These scopes are not included LexicalScopeMap.
|
/// AbstractScopeMap - These scopes are not included LexicalScopeMap.
|
||||||
/// AbstractScopes owns its LexicalScope*s.
|
/// AbstractScopes owns its LexicalScope*s.
|
||||||
DenseMap<const MDNode *, std::unique_ptr<LexicalScope>> AbstractScopeMap;
|
DenseMap<const MDNode *, LexicalScope *> AbstractScopeMap;
|
||||||
|
|
||||||
/// AbstractScopesList - Tracks abstract scopes constructed while processing
|
/// AbstractScopesList - Tracks abstract scopes constructed while processing
|
||||||
/// a function.
|
/// a function.
|
||||||
|
|
|
@ -33,6 +33,8 @@ LexicalScopes::~LexicalScopes() { reset(); }
|
||||||
void LexicalScopes::reset() {
|
void LexicalScopes::reset() {
|
||||||
MF = nullptr;
|
MF = nullptr;
|
||||||
CurrentFnLexicalScope = nullptr;
|
CurrentFnLexicalScope = nullptr;
|
||||||
|
DeleteContainerSeconds(LexicalScopeMap);
|
||||||
|
DeleteContainerSeconds(AbstractScopeMap);
|
||||||
InlinedLexicalScopeMap.clear();
|
InlinedLexicalScopeMap.clear();
|
||||||
AbstractScopesList.clear();
|
AbstractScopesList.clear();
|
||||||
}
|
}
|
||||||
|
@ -122,8 +124,7 @@ LexicalScope *LexicalScopes::findLexicalScope(DebugLoc DL) {
|
||||||
|
|
||||||
if (IA)
|
if (IA)
|
||||||
return InlinedLexicalScopeMap.lookup(DebugLoc::getFromDILocation(IA));
|
return InlinedLexicalScopeMap.lookup(DebugLoc::getFromDILocation(IA));
|
||||||
auto I = LexicalScopeMap.find(Scope);
|
return LexicalScopeMap.lookup(Scope);
|
||||||
return I != LexicalScopeMap.end() ? I->second.get() : nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If
|
/// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If
|
||||||
|
@ -151,39 +152,35 @@ LexicalScope *LexicalScopes::getOrCreateRegularScope(MDNode *Scope) {
|
||||||
D = DIDescriptor(Scope);
|
D = DIDescriptor(Scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto IterBool = LexicalScopeMap.insert(
|
LexicalScope *WScope = LexicalScopeMap.lookup(Scope);
|
||||||
std::make_pair(Scope, std::unique_ptr<LexicalScope>()));
|
if (WScope)
|
||||||
auto &MapValue = *IterBool.first;
|
return WScope;
|
||||||
if (!IterBool.second)
|
|
||||||
return MapValue.second.get();
|
|
||||||
|
|
||||||
LexicalScope *Parent = nullptr;
|
LexicalScope *Parent = nullptr;
|
||||||
if (D.isLexicalBlock())
|
if (D.isLexicalBlock())
|
||||||
Parent = getOrCreateLexicalScope(DebugLoc::getFromDILexicalBlock(Scope));
|
Parent = getOrCreateLexicalScope(DebugLoc::getFromDILexicalBlock(Scope));
|
||||||
MapValue.second =
|
WScope = new LexicalScope(Parent, DIDescriptor(Scope), nullptr, false);
|
||||||
make_unique<LexicalScope>(Parent, DIDescriptor(Scope), nullptr, false);
|
LexicalScopeMap.insert(std::make_pair(Scope, WScope));
|
||||||
if (!Parent && DIDescriptor(Scope).isSubprogram() &&
|
if (!Parent && DIDescriptor(Scope).isSubprogram() &&
|
||||||
DISubprogram(Scope).describes(MF->getFunction()))
|
DISubprogram(Scope).describes(MF->getFunction()))
|
||||||
CurrentFnLexicalScope = MapValue.second.get();
|
CurrentFnLexicalScope = WScope;
|
||||||
|
|
||||||
return MapValue.second.get();
|
return WScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getOrCreateInlinedScope - Find or create an inlined lexical scope.
|
/// getOrCreateInlinedScope - Find or create an inlined lexical scope.
|
||||||
LexicalScope *LexicalScopes::getOrCreateInlinedScope(MDNode *Scope,
|
LexicalScope *LexicalScopes::getOrCreateInlinedScope(MDNode *Scope,
|
||||||
MDNode *InlinedAt) {
|
MDNode *InlinedAt) {
|
||||||
auto IterBool = LexicalScopeMap.insert(
|
LexicalScope *InlinedScope = LexicalScopeMap.lookup(InlinedAt);
|
||||||
std::make_pair(InlinedAt, std::unique_ptr<LexicalScope>()));
|
if (InlinedScope)
|
||||||
auto &MapValue = *IterBool.first;
|
return InlinedScope;
|
||||||
if (!IterBool.second)
|
|
||||||
return MapValue.second.get();
|
|
||||||
|
|
||||||
DebugLoc InlinedLoc = DebugLoc::getFromDILocation(InlinedAt);
|
DebugLoc InlinedLoc = DebugLoc::getFromDILocation(InlinedAt);
|
||||||
MapValue.second =
|
InlinedScope = new LexicalScope(getOrCreateLexicalScope(InlinedLoc),
|
||||||
make_unique<LexicalScope>(getOrCreateLexicalScope(InlinedLoc),
|
DIDescriptor(Scope), InlinedAt, false);
|
||||||
DIDescriptor(Scope), InlinedAt, false);
|
InlinedLexicalScopeMap[InlinedLoc] = InlinedScope;
|
||||||
InlinedLexicalScopeMap[InlinedLoc] = MapValue.second.get();
|
LexicalScopeMap[InlinedAt] = InlinedScope;
|
||||||
return MapValue.second.get();
|
return InlinedScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getOrCreateAbstractScope - Find or create an abstract lexical scope.
|
/// getOrCreateAbstractScope - Find or create an abstract lexical scope.
|
||||||
|
@ -193,11 +190,9 @@ LexicalScope *LexicalScopes::getOrCreateAbstractScope(const MDNode *N) {
|
||||||
DIDescriptor Scope(N);
|
DIDescriptor Scope(N);
|
||||||
if (Scope.isLexicalBlockFile())
|
if (Scope.isLexicalBlockFile())
|
||||||
Scope = DILexicalBlockFile(Scope).getScope();
|
Scope = DILexicalBlockFile(Scope).getScope();
|
||||||
auto IterBool = AbstractScopeMap.insert(
|
LexicalScope *AScope = AbstractScopeMap.lookup(N);
|
||||||
std::make_pair(N, std::unique_ptr<LexicalScope>()));
|
if (AScope)
|
||||||
auto &MapEntry = *IterBool.first;
|
return AScope;
|
||||||
if (!IterBool.second)
|
|
||||||
return MapEntry.second.get();
|
|
||||||
|
|
||||||
LexicalScope *Parent = nullptr;
|
LexicalScope *Parent = nullptr;
|
||||||
if (Scope.isLexicalBlock()) {
|
if (Scope.isLexicalBlock()) {
|
||||||
|
@ -205,11 +200,11 @@ LexicalScope *LexicalScopes::getOrCreateAbstractScope(const MDNode *N) {
|
||||||
DIDescriptor ParentDesc = DB.getContext();
|
DIDescriptor ParentDesc = DB.getContext();
|
||||||
Parent = getOrCreateAbstractScope(ParentDesc);
|
Parent = getOrCreateAbstractScope(ParentDesc);
|
||||||
}
|
}
|
||||||
MapEntry.second =
|
AScope = new LexicalScope(Parent, DIDescriptor(N), nullptr, true);
|
||||||
make_unique<LexicalScope>(Parent, DIDescriptor(N), nullptr, true);
|
AbstractScopeMap[N] = AScope;
|
||||||
if (DIDescriptor(N).isSubprogram())
|
if (DIDescriptor(N).isSubprogram())
|
||||||
AbstractScopesList.push_back(MapEntry.second.get());
|
AbstractScopesList.push_back(AScope);
|
||||||
return MapEntry.second.get();
|
return AScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// constructScopeNest
|
/// constructScopeNest
|
||||||
|
|
Loading…
Reference in New Issue