Home | History | Annotate | Download | only in WebAssembly

Lines Matching refs:LOOP

14 /// order, ignoring loop backedges, and without any loop being interrupted
15 /// by a block not dominated by the loop header, with special care to keep the
18 /// Then, it inserts BLOCK and LOOP markers to mark the start of scopes, since
72 /// Return the "bottom" block of a loop. This differs from
73 /// MachineLoop::getBottomBlock in that it works even if the loop is
75 static MachineBasicBlock *LoopBottom(const MachineLoop *Loop) {
76 MachineBasicBlock *Bottom = Loop->getHeader();
77 for (MachineBasicBlock *MBB : Loop->blocks())
115 /// Bookkeeping for a loop to help ensure that we don't mix blocks not dominated
116 /// by the loop header among the loop's blocks.
118 const MachineLoop *Loop;
121 /// List of blocks not dominated by Loop's header that are deferred until
122 /// after all of Loop's blocks have been seen.
126 : Loop(L), NumBlocksLeft(L->getNumBlocks()) {}
137 // block has, ignoring loop backedges.
151 // - Between a loop header and the last block in the loop, there can be
152 // no blocks not dominated by the loop header.
167 // If MBB is a loop header, add it to the active loop list. We can't put
168 // any blocks that it doesn't dominate until we see the end of the loop.
171 // For each active loop the block is in, decrement the count. If MBB is
172 // the last block in an active loop, take it off the list and pick up any
175 if (E.Loop->contains(MBB) && --E.NumBlocksLeft == 0)
197 // If X isn't dominated by the top active loop header, defer it until that
198 // loop is done.
200 !MDT.dominates(Loops.back().Loop->getHeader(), Next)) {
206 // loop-rotated above the header, it's not preferred.
227 // If Next isn't dominated by the top active loop header, defer it until
228 // that loop is done.
230 !MDT.dominates(Loops.back().Loop->getHeader(), Next)) {
242 assert(Loops.empty() && "Active loop list not finished");
248 // Insert a sentinel representing the degenerate loop that starts at the
249 // function entry block and includes the entire function as a "loop" that
256 MachineLoop *Loop = MLI.getLoopFor(&MBB);
257 if (Loop && &MBB == Loop->getHeader()) {
258 // Loop header. The loop predecessor should be sorted above, and the other
262 (Pred->getNumber() < MBB.getNumber() || Loop->contains(Pred)) &&
263 "Loop header predecessors must be loop predecessors or backedges");
264 assert(OnStack.insert(Loop) && "Loops should be declared at most once.");
266 // Not a loop header. All predecessors should be sorted above.
269 "Non-loop-header predecessors should be topologically sorted");
277 "The function entry block shouldn't actually be a loop header");
352 // If there's a loop which ends just before MBB which contains Header, we can
354 for (MachineLoop *Loop = MLI.getLoopFor(LayoutPred);
355 Loop && Loop->contains(LayoutPred); Loop = Loop->getParentLoop())
356 if (Loop && LoopBottom(Loop) == LayoutPred && Loop->contains(Header))
363 // Header is the header of a loop that does not lexically contain MBB, so
364 // the BLOCK needs to be above the LOOP, after any END constructs.
366 while (InsertPos->getOpcode() != WebAssembly::LOOP)
373 prev(InsertPos)->getOpcode() != WebAssembly::LOOP &&
396 /// Insert a LOOP marker for a loop starting at MBB (if it's a loop header).
402 MachineLoop *Loop = MLI.getLoopFor(&MBB);
403 if (!Loop || Loop->getHeader() != &MBB)
406 // The operand of a LOOP is the first block after the loop. If the loop is the
408 MachineBasicBlock *Bottom = LoopBottom(Loop);
419 loop (after the end of any existing loop that
425 BuildMI(MBB, InsertPos, DebugLoc(), TII.get(WebAssembly::LOOP));
427 // Mark the end of the loop.
434 "With block sorting the outermost loop for a block should be first.");
452 /// Insert LOOP and BLOCK markers at appropriate places.
464 // For eacn LOOP_END, the corresponding LOOP.
468 // Place the LOOP for MBB if MBB is the header of a loop.
485 case WebAssembly::LOOP:
486 assert(Stack.back() == &MBB && "Loop top should be balanced");
531 // Place the BLOCK and LOOP markers to indicate the beginnings of scopes.