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
42 /// initialize - Scan machine function and constuct lexical scope nest.
78 // If scope has not changed then skip this instruction.
90 // current instruction scope does not match scope of first instruction
114 /// findLexicalScope - Find lexical scope, either regular or inlined, for the
117 MDNode *Scope = NULL;
119 DL.getScopeAndInlinedAt(Scope, IA, MF->getFunction()->getContext());
120 if (!Scope) return NULL;
122 // The scope that we were created with could have an extra file - which
124 DIDescriptor D = DIDescriptor(Scope);
126 Scope = DILexicalBlockFile(Scope).getScope();
130 return LexicalScopeMap.lookup(Scope);
133 /// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If
134 /// not available then create new lexical scope.
136 MDNode *Scope = NULL;
138 DL.getScopeAndInlinedAt(Scope, InlinedAt, MF->getFunction()->getContext());
141 // Create an abstract scope for inlined function.
142 getOrCreateAbstractScope(Scope);
143 // Create an inlined scope for inlined function.
144 return getOrCreateInlinedScope(Scope, InlinedAt);
147 return getOrCreateRegularScope(Scope);
150 /// getOrCreateRegularScope - Find or create a regular lexical scope.
151 LexicalScope *LexicalScopes::getOrCreateRegularScope(MDNode *Scope) {
152 DIDescriptor D = DIDescriptor(Scope);
154 Scope = DILexicalBlockFile(Scope).getScope();
155 D = DIDescriptor(Scope);
158 LexicalScope *WScope = LexicalScopeMap.lookup(Scope);
164 Parent = getOrCreateLexicalScope(DebugLoc::getFromDILexicalBlock(Scope));
165 WScope = new LexicalScope(Parent, DIDescriptor(Scope), NULL, false);
166 LexicalScopeMap.insert(std::make_pair(Scope, WScope));
167 if (!Parent && DIDescriptor(Scope).isSubprogram()
168 && DISubprogram(Scope).describes(MF->getFunction()))
174 /// getOrCreateInlinedScope - Find or create an inlined lexical scope.
175 LexicalScope *LexicalScopes::getOrCreateInlinedScope(MDNode *Scope,
183 DIDescriptor(Scope), InlinedAt, false);
189 /// getOrCreateAbstractScope - Find or create an abstract lexical scope.
191 assert(N && "Invalid Scope encoding!");
193 DIDescriptor Scope(N);
194 if (Scope.isLexicalBlockFile())
195 Scope = DILexicalBlockFile(Scope).getScope();
201 if (Scope.isLexicalBlock()) {
214 void LexicalScopes::constructScopeNest(LexicalScope *Scope) {
215 assert (Scope && "Unable to calculate scop edominance graph!");
217 WorkStack.push_back(Scope);
241 /// lexical scope.
265 /// have machine instructions that belong to lexical scope identified by
271 LexicalScope *Scope = getOrCreateLexicalScope(DL);
272 if (!Scope)
275 if (Scope == CurrentFnLexicalScope) {
282 SmallVector<InsnRange, 4> &InsnRanges = Scope->getRanges();
290 /// dominates - Return true if DebugLoc's lexical scope dominates at least one
291 /// machine instruction's lexical scope in a given machine basic block.
293 LexicalScope *Scope = getOrCreateLexicalScope(DL);
294 if (!Scope)
297 // Current function scope covers all basic blocks in the function.
298 if (Scope == CurrentFnLexicalScope && MBB->getParent() == MF)
308 if (Scope->dominates(IScope))
323 err << "Abstract Scope\n";