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 Scope = Scope->getNonLexicalBlockFileScope();
119 auto I = InlinedLexicalScopeMap.find(std::make_pair(Scope, IA));
122 return findLexicalScope(Scope);
125 /// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If
126 /// not available then create new lexical scope.
127 LexicalScope *LexicalScopes::getOrCreateLexicalScope(const DILocalScope *Scope,
130 // Create an abstract scope for inlined function.
131 getOrCreateAbstractScope(Scope);
132 // Create an inlined scope for inlined function.
133 return getOrCreateInlinedScope(Scope, IA);
136 return getOrCreateRegularScope(Scope);
139 /// getOrCreateRegularScope - Find or create a regular lexical scope.
141 LexicalScopes::getOrCreateRegularScope(const DILocalScope *Scope) {
142 assert(Scope && "Invalid Scope encoding!");
143 Scope = Scope->getNonLexicalBlockFileScope();
145 auto I = LexicalScopeMap.find(Scope);
151 if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope))
154 std::forward_as_tuple(Scope),
155 std::forward_as_tuple(Parent, Scope, nullptr,
159 assert(cast<DISubprogram>(Scope)->describes(MF->getFunction()));
167 /// getOrCreateInlinedScope - Find or create an inlined lexical scope.
169 LexicalScopes::getOrCreateInlinedScope(const DILocalScope *Scope,
171 assert(Scope && "Invalid Scope encoding!");
172 Scope = Scope->getNonLexicalBlockFileScope();
173 std::pair<const DILocalScope *, const DILocation *> P(Scope, InlinedAt);
179 if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope))
186 std::forward_as_tuple(Parent, Scope,
192 /// getOrCreateAbstractScope - Find or create an abstract lexical scope.
194 LexicalScopes::getOrCreateAbstractScope(const DILocalScope *Scope) {
195 assert(Scope && "Invalid Scope encoding!");
196 Scope = Scope->getNonLexicalBlockFileScope();
197 auto I = AbstractScopeMap.find(Scope);
203 if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope))
207 std::forward_as_tuple(Scope),
208 std::forward_as_tuple(Parent, Scope,
210 if (isa<DISubprogram>(Scope))
216 void LexicalScopes::constructScopeNest(LexicalScope *Scope) {
217 assert(Scope && "Unable to calculate scope dominance graph!");
219 WorkStack.push_back(Scope);
244 /// lexical scope.
268 /// have machine instructions that belong to lexical scope identified by
273 LexicalScope *Scope = getOrCreateLexicalScope(DL);
274 if (!Scope)
277 if (Scope == CurrentFnLexicalScope) {
283 SmallVectorImpl<InsnRange> &InsnRanges = Scope->getRanges();
292 /// dominates - Return true if DebugLoc's lexical scope dominates at least one
293 /// machine instruction's lexical scope in a given machine basic block.
295 LexicalScope *Scope = getOrCreateLexicalScope(DL);
296 if (!Scope)
299 // Current function scope covers all basic blocks in the function.
300 if (Scope == CurrentFnLexicalScope && MBB->getParent() == MF)
308 if (Scope->dominates(IScope))
324 err << std::string(Indent, ' ') << "Abstract Scope\n";