• Home
  • Raw
  • Download

Lines Matching full: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. in extractLexicalScopes()
83 // current instruction scope does not match scope of first instruction in extractLexicalScopes()
107 /// findLexicalScope - Find lexical scope, either regular or inlined, for the
110 DILocalScope *Scope = DL->getScope(); in findLexicalScope() local
111 if (!Scope) in findLexicalScope()
114 // The scope that we were created with could have an extra file - which in findLexicalScope()
116 Scope = Scope->getNonLexicalBlockFileScope(); in findLexicalScope()
119 auto I = InlinedLexicalScopeMap.find(std::make_pair(Scope, IA)); in findLexicalScope()
122 return findLexicalScope(Scope); in findLexicalScope()
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, in getOrCreateLexicalScope() argument
130 // Create an abstract scope for inlined function. in getOrCreateLexicalScope()
131 getOrCreateAbstractScope(Scope); in getOrCreateLexicalScope()
132 // Create an inlined scope for inlined function. in getOrCreateLexicalScope()
133 return getOrCreateInlinedScope(Scope, IA); in getOrCreateLexicalScope()
136 return getOrCreateRegularScope(Scope); in getOrCreateLexicalScope()
139 /// getOrCreateRegularScope - Find or create a regular lexical scope.
141 LexicalScopes::getOrCreateRegularScope(const DILocalScope *Scope) { in getOrCreateRegularScope() argument
142 assert(Scope && "Invalid Scope encoding!"); in getOrCreateRegularScope()
143 Scope = Scope->getNonLexicalBlockFileScope(); in getOrCreateRegularScope()
145 auto I = LexicalScopeMap.find(Scope); in getOrCreateRegularScope()
151 if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope)) in getOrCreateRegularScope()
154 std::forward_as_tuple(Scope), in getOrCreateRegularScope()
155 std::forward_as_tuple(Parent, Scope, nullptr, in getOrCreateRegularScope()
159 assert(cast<DISubprogram>(Scope)->describes(MF->getFunction())); in getOrCreateRegularScope()
167 /// getOrCreateInlinedScope - Find or create an inlined lexical scope.
169 LexicalScopes::getOrCreateInlinedScope(const DILocalScope *Scope, in getOrCreateInlinedScope() argument
171 assert(Scope && "Invalid Scope encoding!"); in getOrCreateInlinedScope()
172 Scope = Scope->getNonLexicalBlockFileScope(); in getOrCreateInlinedScope()
173 std::pair<const DILocalScope *, const DILocation *> P(Scope, InlinedAt); in getOrCreateInlinedScope()
179 if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope)) in getOrCreateInlinedScope()
186 std::forward_as_tuple(Parent, Scope, in getOrCreateInlinedScope()
192 /// getOrCreateAbstractScope - Find or create an abstract lexical scope.
194 LexicalScopes::getOrCreateAbstractScope(const DILocalScope *Scope) { in getOrCreateAbstractScope() argument
195 assert(Scope && "Invalid Scope encoding!"); in getOrCreateAbstractScope()
196 Scope = Scope->getNonLexicalBlockFileScope(); in getOrCreateAbstractScope()
197 auto I = AbstractScopeMap.find(Scope); in getOrCreateAbstractScope()
203 if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope)) in getOrCreateAbstractScope()
207 std::forward_as_tuple(Scope), in getOrCreateAbstractScope()
208 std::forward_as_tuple(Parent, Scope, in getOrCreateAbstractScope()
210 if (isa<DISubprogram>(Scope)) in getOrCreateAbstractScope()
216 void LexicalScopes::constructScopeNest(LexicalScope *Scope) { in constructScopeNest() argument
217 assert(Scope && "Unable to calculate scope dominance graph!"); in constructScopeNest()
219 WorkStack.push_back(Scope); in constructScopeNest()
244 /// lexical scope.
268 /// have machine instructions that belong to lexical scope identified by
273 LexicalScope *Scope = getOrCreateLexicalScope(DL); in getMachineBasicBlocks() local
274 if (!Scope) in getMachineBasicBlocks()
277 if (Scope == CurrentFnLexicalScope) { in getMachineBasicBlocks()
283 SmallVectorImpl<InsnRange> &InsnRanges = Scope->getRanges(); in getMachineBasicBlocks()
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); in dominates() local
296 if (!Scope) in dominates()
299 // Current function scope covers all basic blocks in the function. in dominates()
300 if (Scope == CurrentFnLexicalScope && MBB->getParent() == MF) in dominates()
308 if (Scope->dominates(IScope)) in dominates()
324 err << std::string(Indent, ' ') << "Abstract Scope\n"; in dump()