• Home
  • Raw
  • Download

Lines Matching full:scope

1 //===- LexicalScopes.cpp - Collecting lexical scope info ------------------===//
11 // This pass collects lexical scope information and maps machine instructions
50 /// initialize - Scan machine function and constuct lexical scope nest.
53 // Don't attempt any lexical scope creation for a NoDebug compile unit. in initialize()
85 // If scope has not changed then skip this instruction. in extractLexicalScopes()
98 // current instruction scope does not match scope of first instruction in extractLexicalScopes()
122 /// findLexicalScope - Find lexical scope, either regular or inlined, for the
125 DILocalScope *Scope = DL->getScope(); in findLexicalScope() local
126 if (!Scope) in findLexicalScope()
129 // The scope that we were created with could have an extra file - which in findLexicalScope()
131 Scope = Scope->getNonLexicalBlockFileScope(); in findLexicalScope()
134 auto I = InlinedLexicalScopeMap.find(std::make_pair(Scope, IA)); in findLexicalScope()
137 return findLexicalScope(Scope); in findLexicalScope()
140 /// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If
141 /// not available then create new lexical scope.
142 LexicalScope *LexicalScopes::getOrCreateLexicalScope(const DILocalScope *Scope, in getOrCreateLexicalScope() argument
146 if (Scope->getSubprogram()->getUnit()->getEmissionKind() == in getOrCreateLexicalScope()
149 // Create an abstract scope for inlined function. in getOrCreateLexicalScope()
150 getOrCreateAbstractScope(Scope); in getOrCreateLexicalScope()
151 // Create an inlined scope for inlined function. in getOrCreateLexicalScope()
152 return getOrCreateInlinedScope(Scope, IA); in getOrCreateLexicalScope()
155 return getOrCreateRegularScope(Scope); in getOrCreateLexicalScope()
158 /// getOrCreateRegularScope - Find or create a regular lexical scope.
160 LexicalScopes::getOrCreateRegularScope(const DILocalScope *Scope) { in getOrCreateRegularScope() argument
161 assert(Scope && "Invalid Scope encoding!"); in getOrCreateRegularScope()
162 Scope = Scope->getNonLexicalBlockFileScope(); in getOrCreateRegularScope()
164 auto I = LexicalScopeMap.find(Scope); in getOrCreateRegularScope()
170 if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope)) in getOrCreateRegularScope()
173 std::forward_as_tuple(Scope), in getOrCreateRegularScope()
174 std::forward_as_tuple(Parent, Scope, nullptr, in getOrCreateRegularScope()
178 assert(cast<DISubprogram>(Scope)->describes(&MF->getFunction())); in getOrCreateRegularScope()
186 /// getOrCreateInlinedScope - Find or create an inlined lexical scope.
188 LexicalScopes::getOrCreateInlinedScope(const DILocalScope *Scope, in getOrCreateInlinedScope() argument
190 assert(Scope && "Invalid Scope encoding!"); in getOrCreateInlinedScope()
191 Scope = Scope->getNonLexicalBlockFileScope(); in getOrCreateInlinedScope()
192 std::pair<const DILocalScope *, const DILocation *> P(Scope, InlinedAt); in getOrCreateInlinedScope()
198 if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope)) in getOrCreateInlinedScope()
205 std::forward_as_tuple(Parent, Scope, InlinedAt, false)) in getOrCreateInlinedScope()
210 /// getOrCreateAbstractScope - Find or create an abstract lexical scope.
212 LexicalScopes::getOrCreateAbstractScope(const DILocalScope *Scope) { in getOrCreateAbstractScope() argument
213 assert(Scope && "Invalid Scope encoding!"); in getOrCreateAbstractScope()
214 Scope = Scope->getNonLexicalBlockFileScope(); in getOrCreateAbstractScope()
215 auto I = AbstractScopeMap.find(Scope); in getOrCreateAbstractScope()
221 if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope)) in getOrCreateAbstractScope()
225 std::forward_as_tuple(Scope), in getOrCreateAbstractScope()
226 std::forward_as_tuple(Parent, Scope, in getOrCreateAbstractScope()
228 if (isa<DISubprogram>(Scope)) in getOrCreateAbstractScope()
233 /// constructScopeNest - Traverse the Scope tree depth-first, storing
236 void LexicalScopes::constructScopeNest(LexicalScope *Scope) { in constructScopeNest() argument
237 assert(Scope && "Unable to calculate scope dominance graph!"); in constructScopeNest()
239 WorkStack.push_back(std::make_pair(Scope, 0)); in constructScopeNest()
258 /// lexical scope.
278 /// have machine instructions that belong to lexical scope identified by
285 LexicalScope *Scope = getOrCreateLexicalScope(DL); in getMachineBasicBlocks() local
286 if (!Scope) in getMachineBasicBlocks()
289 if (Scope == CurrentFnLexicalScope) { in getMachineBasicBlocks()
295 // The scope ranges can cover multiple basic blocks in each span. Iterate over in getMachineBasicBlocks()
298 SmallVectorImpl<InsnRange> &InsnRanges = Scope->getRanges(); in getMachineBasicBlocks()
308 LexicalScope *Scope = getOrCreateLexicalScope(DL); in dominates() local
309 if (!Scope) in dominates()
312 // Current function scope covers all basic blocks in the function. in dominates()
313 if (Scope == CurrentFnLexicalScope && MBB->getParent() == MF) in dominates()
316 // Fetch all the blocks in DLs scope. Because the range / block list also in dominates()
339 err << std::string(Indent, ' ') << "Abstract Scope\n"; in dump()