@@ -34,13 +34,12 @@ class MachineInstr;
3434class MDNode ;
3535
3636// ===----------------------------------------------------------------------===//
37- // / InsnRange - This is used to track range of instructions with identical
38- // / lexical scope.
37+ // / This is used to track range of instructions with identical lexical scope.
3938// /
4039using InsnRange = std::pair<const MachineInstr *, const MachineInstr *>;
4140
4241// ===----------------------------------------------------------------------===//
43- // / LexicalScope - This class is used to track scope information.
42+ // / This class is used to track scope information.
4443// /
4544class LexicalScope {
4645public:
@@ -66,10 +65,10 @@ class LexicalScope {
6665 SmallVectorImpl<LexicalScope *> &getChildren () { return Children; }
6766 SmallVectorImpl<InsnRange> &getRanges () { return Ranges; }
6867
69- // / addChild - Add a child scope.
68+ // / Add a child scope.
7069 void addChild (LexicalScope *S) { Children.push_back (S); }
7170
72- // / openInsnRange - This scope covers instruction range starting from MI.
71+ // / This scope covers instruction range starting from MI.
7372 void openInsnRange (const MachineInstr *MI) {
7473 if (!FirstInsn)
7574 FirstInsn = MI;
@@ -78,18 +77,17 @@ class LexicalScope {
7877 Parent->openInsnRange (MI);
7978 }
8079
81- // / extendInsnRange - Extend the current instruction range covered by
82- // / this scope.
80+ // / Extend the current instruction range covered by this scope.
8381 void extendInsnRange (const MachineInstr *MI) {
8482 assert (FirstInsn && " MI Range is not open!" );
8583 LastInsn = MI;
8684 if (Parent)
8785 Parent->extendInsnRange (MI);
8886 }
8987
90- // / closeInsnRange - Create a range based on FirstInsn and LastInsn collected
91- // / until now. This is used when a new scope is encountered while walking
92- // / machine instructions.
88+ // / Create a range based on FirstInsn and LastInsn collected until now.
89+ // / This is used when a new scope is encountered while walking machine
90+ // / instructions.
9391 void closeInsnRange (LexicalScope *NewScope = nullptr ) {
9492 assert (LastInsn && " Last insn missing!" );
9593 Ranges.push_back (InsnRange (FirstInsn, LastInsn));
@@ -101,7 +99,7 @@ class LexicalScope {
10199 Parent->closeInsnRange (NewScope);
102100 }
103101
104- // / dominates - Return true if current scope dominates given lexical scope.
102+ // / Return true if current scope dominates given lexical scope.
105103 bool dominates (const LexicalScope *S) const {
106104 if (S == this )
107105 return true ;
@@ -116,7 +114,7 @@ class LexicalScope {
116114 unsigned getDFSIn () const { return DFSIn; }
117115 void setDFSIn (unsigned I) { DFSIn = I; }
118116
119- // / dump - print lexical scope.
117+ // / Print lexical scope.
120118 LLVM_ABI void dump (unsigned Indent = 0 ) const ;
121119
122120private:
@@ -136,31 +134,30 @@ class LexicalScope {
136134};
137135
138136// ===----------------------------------------------------------------------===//
139- // / LexicalScopes - This class provides interface to collect and use lexical
140- // / scoping information from machine instruction.
137+ // / This class provides interface to collect and use lexical scoping information
138+ // / from machine instruction.
141139// /
142140class LexicalScopes {
143141public:
144142 LexicalScopes () = default ;
145143
146- // / initialize - Scan machine function and constuct lexical scope nest, resets
144+ // / Scan machine function and constuct lexical scope nest, resets
147145 // / the instance if necessary.
148146 LLVM_ABI void initialize (const MachineFunction &);
149147
150- // / releaseMemory - release memory.
148+ // / Release memory.
151149 LLVM_ABI void reset ();
152150
153- // / empty - Return true if there is any lexical scope information available.
151+ // / Return true if there is any lexical scope information available.
154152 bool empty () { return CurrentFnLexicalScope == nullptr ; }
155153
156- // / getCurrentFunctionScope - Return lexical scope for the current function.
154+ // / Return lexical scope for the current function.
157155 LexicalScope *getCurrentFunctionScope () const {
158156 return CurrentFnLexicalScope;
159157 }
160158
161- // / getMachineBasicBlocks - Populate given set using machine basic blocks
162- // / which have machine instructions that belong to lexical scope identified by
163- // / DebugLoc.
159+ // / Populate given set using machine basic blocks which have machine
160+ // / instructions that belong to lexical scope identified by DebugLoc.
164161 LLVM_ABI void
165162 getMachineBasicBlocks (const DILocation *DL,
166163 SmallPtrSetImpl<const MachineBasicBlock *> &MBBs);
@@ -169,39 +166,39 @@ class LexicalScopes {
169166 // / instruction's lexical scope in a given machine basic block.
170167 LLVM_ABI bool dominates (const DILocation *DL, MachineBasicBlock *MBB);
171168
172- // / findLexicalScope - Find lexical scope, either regular or inlined, for the
173- // / given DebugLoc. Return NULL if not found.
169+ // / Find lexical scope, either regular or inlined, for the given DebugLoc.
170+ // / Return NULL if not found.
174171 LLVM_ABI LexicalScope *findLexicalScope (const DILocation *DL);
175172
176- // / getAbstractScopesList - Return a reference to list of abstract scopes.
173+ // / Return a reference to list of abstract scopes.
177174 ArrayRef<LexicalScope *> getAbstractScopesList () const {
178175 return AbstractScopesList;
179176 }
180177
181- // / findAbstractScope - Find an abstract scope or return null.
178+ // / Find an abstract scope or return null.
182179 LexicalScope *findAbstractScope (const DILocalScope *N) {
183180 auto I = AbstractScopeMap.find (N);
184181 return I != AbstractScopeMap.end () ? &I->second : nullptr ;
185182 }
186183
187- // / findInlinedScope - Find an inlined scope for the given scope/inlined-at.
184+ // / Find an inlined scope for the given scope/inlined-at.
188185 LexicalScope *findInlinedScope (const DILocalScope *N, const DILocation *IA) {
189186 auto I = InlinedLexicalScopeMap.find (std::make_pair (N, IA));
190187 return I != InlinedLexicalScopeMap.end () ? &I->second : nullptr ;
191188 }
192189
193- // / findLexicalScope - Find regular lexical scope or return null.
190+ // / Find regular lexical scope or return null.
194191 LexicalScope *findLexicalScope (const DILocalScope *N) {
195192 auto I = LexicalScopeMap.find (N);
196193 return I != LexicalScopeMap.end () ? &I->second : nullptr ;
197194 }
198195
199- // / getOrCreateAbstractScope - Find or create an abstract lexical scope.
196+ // / Find or create an abstract lexical scope.
200197 LLVM_ABI LexicalScope *getOrCreateAbstractScope (const DILocalScope *Scope);
201198
202199private:
203- // / getOrCreateLexicalScope - Find lexical scope for the given Scope/IA. If
204- // / not available then create new lexical scope.
200+ // / Find lexical scope for the given Scope/IA. If not available
201+ // / then create new lexical scope.
205202 LLVM_ABI LexicalScope *
206203 getOrCreateLexicalScope (const DILocalScope *Scope,
207204 const DILocation *IA = nullptr );
@@ -210,14 +207,14 @@ class LexicalScopes {
210207 : nullptr ;
211208 }
212209
213- // / getOrCreateRegularScope - Find or create a regular lexical scope.
210+ // / Find or create a regular lexical scope.
214211 LexicalScope *getOrCreateRegularScope (const DILocalScope *Scope);
215212
216- // / getOrCreateInlinedScope - Find or create an inlined lexical scope.
213+ // / Find or create an inlined lexical scope.
217214 LexicalScope *getOrCreateInlinedScope (const DILocalScope *Scope,
218215 const DILocation *InlinedAt);
219216
220- // / extractLexicalScopes - Extract instruction ranges for each lexical scopes
217+ // / Extract instruction ranges for each lexical scopes
221218 // / for the given machine function.
222219 void extractLexicalScopes (SmallVectorImpl<InsnRange> &MIRanges,
223220 DenseMap<const MachineInstr *, LexicalScope *> &M);
@@ -228,27 +225,24 @@ class LexicalScopes {
228225
229226 const MachineFunction *MF = nullptr ;
230227
231- // / LexicalScopeMap - Tracks the scopes in the current function.
228+ // / Tracks the scopes in the current function.
232229 // Use an unordered_map to ensure value pointer validity over insertion.
233230 std::unordered_map<const DILocalScope *, LexicalScope> LexicalScopeMap;
234231
235- // / InlinedLexicalScopeMap - Tracks inlined function scopes in current
236- // / function.
232+ // / Tracks inlined function scopes in current function.
237233 std::unordered_map<std::pair<const DILocalScope *, const DILocation *>,
238234 LexicalScope,
239235 pair_hash<const DILocalScope *, const DILocation *>>
240236 InlinedLexicalScopeMap;
241237
242- // / AbstractScopeMap - These scopes are not included LexicalScopeMap.
238+ // / These scopes are not included LexicalScopeMap.
243239 // Use an unordered_map to ensure value pointer validity over insertion.
244240 std::unordered_map<const DILocalScope *, LexicalScope> AbstractScopeMap;
245241
246- // / AbstractScopesList - Tracks abstract scopes constructed while processing
247- // / a function.
242+ // / Tracks abstract scopes constructed while processing a function.
248243 SmallVector<LexicalScope *, 4 > AbstractScopesList;
249244
250- // / CurrentFnLexicalScope - Top level scope for the current function.
251- // /
245+ // / Top level scope for the current function.
252246 LexicalScope *CurrentFnLexicalScope = nullptr ;
253247
254248 // / Map a location to the set of basic blocks it dominates. This is a cache
0 commit comments