Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
dart::InductionVarAnalysis Class Reference
Inheritance diagram for dart::InductionVarAnalysis:
dart::ValueObject

Public Member Functions

 InductionVarAnalysis (const GrowableArray< BlockEntryInstr * > &preorder)
 
void VisitHierarchy (LoopInfo *loop)
 
void VisitLoop (LoopInfo *loop)
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 25 of file loops.cc.

Constructor & Destructor Documentation

◆ InductionVarAnalysis()

dart::InductionVarAnalysis::InductionVarAnalysis ( const GrowableArray< BlockEntryInstr * > &  preorder)
inlineexplicit

Definition at line 28 of file loops.cc.

29 : preorder_(preorder),
30 stack_(),
31 scc_(),
32 cycle_(),
33 map_(),
34 current_index_(0),
35 zone_(Thread::Current()->zone()) {}
static Thread * Current()
Definition: thread.h:362

Member Function Documentation

◆ VisitHierarchy()

void dart::InductionVarAnalysis::VisitHierarchy ( LoopInfo loop)

Definition at line 209 of file loops.cc.

209 {
210 for (; loop != nullptr; loop = loop->next_) {
211 VisitLoop(loop);
212 VisitHierarchy(loop->inner_);
213 }
214}
void VisitHierarchy(LoopInfo *loop)
Definition: loops.cc:209
void VisitLoop(LoopInfo *loop)
Definition: loops.cc:216

◆ VisitLoop()

void dart::InductionVarAnalysis::VisitLoop ( LoopInfo loop)

Definition at line 216 of file loops.cc.

216 {
217 loop->ResetInduction();
218 // Find strongly connected components (SSCs) in the SSA graph of this
219 // loop using Tarjan's algorithm. Due to the descendant-first nature,
220 // classification happens "on-demand".
221 current_index_ = 0;
222 ASSERT(stack_.is_empty());
223 ASSERT(map_.IsEmpty());
224 ASSERT(branches_.is_empty());
225 for (BitVector::Iterator it(loop->blocks_); !it.Done(); it.Advance()) {
226 BlockEntryInstr* block = preorder_[it.Current()];
227 ASSERT(block->loop_info() != nullptr);
228 if (block->loop_info() != loop) {
229 continue; // inner loop
230 }
231 // Visit phi-operations.
232 if (block->IsJoinEntry()) {
233 for (PhiIterator it(block->AsJoinEntry()); !it.Done(); it.Advance()) {
234 Visit(loop, it.Current());
235 }
236 }
237 // Visit instructions and collect branches.
238 for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
239 Instruction* instruction = it.Current();
240 Visit(loop, instruction->AsDefinition());
241 if (instruction->IsBranch()) {
242 branches_.Add(instruction->AsBranch());
243 }
244 }
245 }
246 ASSERT(stack_.is_empty());
247 map_.Clear();
248 // Classify loop control.
249 ClassifyControl(loop);
250 branches_.Clear();
251}
#define ASSERT(E)

The documentation for this class was generated from the following file: