Home | History | Annotate | Download | only in CodeGen

Lines Matching refs:Scope

1 //===- LexicalScopes.cpp - Collecting lexical scope info ------------------===//
12 // This pass collects lexical scope information and maps machine instructions
39 /// initialize - Scan machine function and constuct lexical scope nest.
71 // If scope has not changed then skip this instruction.
83 // current instruction scope does not match scope of first instruction
107 /// findLexicalScope - Find lexical scope, either regular or inlined, for the
110 DILocalScope *Scope = DL->getScope();
111 if (!Scope)
114 // The scope that we were created with could have an extra file - which
116 if (auto *File = dyn_cast<DILexicalBlockFile>(Scope))
117 Scope = File->getScope();
120 auto I = InlinedLexicalScopeMap.find(std::make_pair(Scope, IA));
123 return findLexicalScope(Scope);
126 /// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If
127 /// not available then create new lexical scope.
128 LexicalScope *LexicalScopes::getOrCreateLexicalScope(const DILocalScope *Scope,
131 // Create an abstract scope for inlined function.
132 getOrCreateAbstractScope(Scope);
133 // Create an inlined scope for inlined function.
134 return getOrCreateInlinedScope(Scope, IA);
137 return getOrCreateRegularScope(Scope);
140 /// getOrCreateRegularScope - Find or create a regular lexical scope.
142 LexicalScopes::getOrCreateRegularScope(const DILocalScope *Scope) {
143 if (auto *File = dyn_cast<DILexicalBlockFile>(Scope))
144 Scope = File->getScope();
146 auto I = LexicalScopeMap.find(Scope);
152 if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope))
155 std::forward_as_tuple(Scope),
156 std::forward_as_tuple(Parent, Scope, nullptr,
160 assert(cast<DISubprogram>(Scope)->describes(MF->getFunction()));
168 /// getOrCreateInlinedScope - Find or create an inlined lexical scope.
170 LexicalScopes::getOrCreateInlinedScope(const DILocalScope *Scope,
172 std::pair<const DILocalScope *, const DILocation *> P(Scope, InlinedAt);
178 if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope))
185 std::forward_as_tuple(Parent, Scope,
191 /// getOrCreateAbstractScope - Find or create an abstract lexical scope.
193 LexicalScopes::getOrCreateAbstractScope(const DILocalScope *Scope) {
194 assert(Scope && "Invalid Scope encoding!");
196 if (auto *File = dyn_cast<DILexicalBlockFile>(Scope))
197 Scope = File->getScope();
198 auto I = AbstractScopeMap.find(Scope);
204 if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope))
208 std::forward_as_tuple(Scope),
209 std::forward_as_tuple(Parent, Scope,
211 if (isa<DISubprogram>(Scope))
217 void LexicalScopes::constructScopeNest(LexicalScope *Scope) {
218 assert(Scope && "Unable to calculate scope dominance graph!");
220 WorkStack.push_back(Scope);
245 /// lexical scope.
269 /// have machine instructions that belong to lexical scope identified by
274 LexicalScope *Scope = getOrCreateLexicalScope(DL);
275 if (!Scope)
278 if (Scope == CurrentFnLexicalScope) {
284 SmallVectorImpl<InsnRange> &InsnRanges = Scope->getRanges();
293 /// dominates - Return true if DebugLoc's lexical scope dominates at least one
294 /// machine instruction's lexical scope in a given machine basic block.
296 LexicalScope *Scope = getOrCreateLexicalScope(DL);
297 if (!Scope)
300 // Current function scope covers all basic blocks in the function.
301 if (Scope == CurrentFnLexicalScope && MBB->getParent() == MF)
309 if (Scope->dominates(IScope))
325 err << std::string(Indent, ' ') << "Abstract Scope\n";