Lines Matching defs:loop
32 * 3. Replace all "break" with a single conditional one at the end of the loop
42 * Continues are lowered by adding a per-loop "execute flag", initialized to
43 * true, that when cleared inhibits all execution until the end of the loop.
46 * at the end of the loop, and trigger the unique "break".
54 * a dummy loop and using break.
86 * - It assumes it is always possible for control to flow from a loop
88 * is not true (since all execution paths through the loop might
101 * continue to the top of the innermost enclosing loop, break out
109 * continue to the top of the innermost enclosing loop, break out
116 * continue to the top of the innermost enclosing loop, break out
123 * top of the innermost enclosing loop. It can only break out of
130 * top of the innermost enclosing loop, or break out of it. It can
164 ir_loop* loop;
177 this->loop = p_loop;
186 /* also supported for the "function loop" */
188 exec_list& list = this->loop ? this->loop->body_instructions : signature->body;
241 * this->loop.may_set_return_flag are updated to reflect the
263 struct loop_record loop;
319 this->loop.may_set_return_flag = true;
349 * this->loop.may_set_return_flag, because an unlowered jump
371 * this->loop.may_set_return_flag, because an unlowered return
458 if(this->loop.nesting_depth == 0 && ir->get_next()->is_tail_sentinel())
459 this->loop.in_if_at_the_end_of_the_loop = true;
462 ++this->loop.nesting_depth;
509 * necessary by the loop or conditional that encloses it.
539 * satisfied, so we can break out of the loop.
562 * is satisfied and we can break out of the loop.
573 if(this->loop.loop) {
574 /* If we are in a loop, replace the return instruction
575 * with a break instruction, and then loop so that the
588 /* If we are not in a loop, we then proceed as we would
601 * loop doesn't have one already) and replace the continue
605 * return statements that are not inside a loop, so
606 * this->loop must be initialized even outside of loops.
608 ir_variable* execute_flag = this->loop.get_execute_flag();
619 /* Let the loop run again, in case the other branch of the
731 if(ir_if_cond_deref && ir_if_cond_deref->var == this->loop.execute_flag) {
749 assert(this->loop.execute_flag);
750 ir_if* if_execute = new(ir) ir_if(new(ir) ir_dereference_variable(this->loop.execute_flag));
756 --this->loop.nesting_depth;
762 /* Visit the body of the loop, with a fresh data structure in
763 * this->loop so that the analysis we do here won't bleed into
766 * We assume that all code after a loop is reachable from the
767 * loop (see comments on enum jump_strength), so the
776 * The loop.may_set_return_flag portion of the ANALYSIS
780 loop_record saved_loop = this->loop;
781 this->loop = loop_record(this->function.signature, ir);
786 * loop, which are handled below.
790 /* If the loop ends in an unconditional continue, eliminate it
799 /* If the loop ends in an unconditional return, and we are
806 /* FINISHME: If the min_strength of the loop body is
808 * isn't a loop at all, since control flow always leaves the
809 * body of the loop via break or return. In principle the
810 * loop could be eliminated in this case. This optimization
816 /* If the body of the loop may set the return flag, then at
818 * that the return flag is checked after the body of the loop is
821 if(this->loop.may_set_return_flag) {
827 * satisfies the loop.may_set_return_flag part of the
831 if(saved_loop.loop)
832 /* If this loop is nested inside another one, then the if
834 * loop if the return flag is set. Caller will lower that
846 /* In case the loop is embedded inside an if add a new return to
862 this->loop = saved_loop;
870 assert(!this->loop.loop);
879 loop_record saved_loop = this->loop;
881 this->loop = loop_record(ir);
883 assert(!this->loop.loop);
908 this->loop = saved_loop;