summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LexicalScopes.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-30 21:54:46 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-30 21:54:46 +0000
commit5a227fffe5cfa482ae9f8f7fb8e06632bfa3971d (patch)
tree8f7c051fdf2b702b8bfdef5e4fca7f6f7fdeeeb2 /llvm/lib/CodeGen/LexicalScopes.cpp
parent7099d51275382a7686970b4689e4a638c08462f2 (diff)
downloadbcm5719-llvm-5a227fffe5cfa482ae9f8f7fb8e06632bfa3971d.tar.gz
bcm5719-llvm-5a227fffe5cfa482ae9f8f7fb8e06632bfa3971d.zip
LexicalScopes: Use MDLocation directly instead of DebugLoc
There's no benefit to using `DebugLoc` here. Moreover, this will let a follow-up commit work with `MDScope` directly instead of `DebugLoc`. llvm-svn: 233610
Diffstat (limited to 'llvm/lib/CodeGen/LexicalScopes.cpp')
-rw-r--r--llvm/lib/CodeGen/LexicalScopes.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/LexicalScopes.cpp b/llvm/lib/CodeGen/LexicalScopes.cpp
index 05c8221f17b..bf0160a6079 100644
--- a/llvm/lib/CodeGen/LexicalScopes.cpp
+++ b/llvm/lib/CodeGen/LexicalScopes.cpp
@@ -106,18 +106,17 @@ void LexicalScopes::extractLexicalScopes(
/// findLexicalScope - Find lexical scope, either regular or inlined, for the
/// given DebugLoc. Return NULL if not found.
-LexicalScope *LexicalScopes::findLexicalScope(DebugLoc DL) {
- auto *Scope = DL.getScope();
+LexicalScope *LexicalScopes::findLexicalScope(const MDLocation *DL) {
+ MDLocalScope *Scope = DL->getScope();
if (!Scope)
return nullptr;
// The scope that we were created with could have an extra file - which
// isn't what we care about in this case.
- DIDescriptor D = DIDescriptor(Scope);
- if (D.isLexicalBlockFile())
- Scope = DILexicalBlockFile(Scope).getScope();
+ if (auto *File = dyn_cast<MDLexicalBlockFile>(Scope))
+ Scope = File->getScope();
- if (auto *IA = DL.getInlinedAt()) {
+ if (auto *IA = DL->getInlinedAt()) {
auto I = InlinedLexicalScopeMap.find(std::make_pair(Scope, IA));
return I != InlinedLexicalScopeMap.end() ? &I->second : nullptr;
}
@@ -126,12 +125,11 @@ LexicalScope *LexicalScopes::findLexicalScope(DebugLoc DL) {
/// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If
/// not available then create new lexical scope.
-LexicalScope *LexicalScopes::getOrCreateLexicalScope(DebugLoc DL) {
+LexicalScope *LexicalScopes::getOrCreateLexicalScope(const MDLocation *DL) {
if (!DL)
return nullptr;
-
- MDNode *Scope = DL.getScope();
- if (auto *InlinedAt = DL.getInlinedAt()) {
+ MDScope *Scope = DL->getScope();
+ if (auto *InlinedAt = DL->getInlinedAt()) {
// Create an abstract scope for inlined function.
getOrCreateAbstractScope(Scope);
// Create an inlined scope for inlined function.
@@ -276,7 +274,7 @@ void LexicalScopes::assignInstructionRanges(
/// have machine instructions that belong to lexical scope identified by
/// DebugLoc.
void LexicalScopes::getMachineBasicBlocks(
- DebugLoc DL, SmallPtrSetImpl<const MachineBasicBlock *> &MBBs) {
+ const MDLocation *DL, SmallPtrSetImpl<const MachineBasicBlock *> &MBBs) {
MBBs.clear();
LexicalScope *Scope = getOrCreateLexicalScope(DL);
if (!Scope)
@@ -299,7 +297,7 @@ void LexicalScopes::getMachineBasicBlocks(
/// dominates - Return true if DebugLoc's lexical scope dominates at least one
/// machine instruction's lexical scope in a given machine basic block.
-bool LexicalScopes::dominates(DebugLoc DL, MachineBasicBlock *MBB) {
+bool LexicalScopes::dominates(const MDLocation *DL, MachineBasicBlock *MBB) {
LexicalScope *Scope = getOrCreateLexicalScope(DL);
if (!Scope)
return false;
OpenPOWER on IntegriCloud