Home | History | Annotate | Download | only in Hexagon

Lines Matching defs:loop

132 /// Find the hardware loop instruction used to set-up the specified loop.
133 /// On Hexagon, we have two instructions used to set-up the hardware loop
135 /// to indicate the end of a loop.
148 // The loop set-up instruction will be in a predecessor block
161 // We've reached a different loop, which means the loop0 has been removed.
165 // Check the predecessors for the LOOP instruction.
166 MachineInstr *loop = findLoopInstr(*PB, EndLoopOp, Visited);
167 if (loop)
168 return loop;
365 /// HW-loop ENDLOOP:
585 // into an infinite loop.
602 // Since we're adding an ENDLOOP, there better be a LOOP instruction.
605 MachineInstr *Loop = findLoopInstr(TBB, EndLoopOp, VisitedBBs);
606 assert(Loop != 0 && "Inserting an ENDLOOP without a LOOP");
607 Loop->getOperand(0).setMBB(TBB);
642 // Since we're adding an ENDLOOP, there better be a LOOP instruction.
645 MachineInstr *Loop = findLoopInstr(TBB, EndLoopOp, VisitedBBs);
646 assert(Loop != 0 && "Inserting an ENDLOOP without a LOOP");
647 Loop->getOperand(0).setMBB(TBB);
660 /// Analyze the loop code to find the loop induction variable and compare used
661 /// to compute the number of iterations. Currently, we analyze loop that are
680 /// Generate code to reduce the loop iteration by one and check if the loop is
681 /// finished. Return the value/register of the new loop count. this function
688 // We expect a hardware loop currently. This means that IndVar is set
691 && "Expecting a hardware loop");
695 MachineInstr *Loop = findLoopInstr(&MBB, Cmp->getOpcode(), VisitedBBs);
696 if (!Loop)
698 // If the loop trip count is a compile-time value, then just change the
700 if (Loop->getOpcode() == Hexagon::J2_loop0i ||
701 Loop->getOpcode() == Hexagon::J2_loop1i) {
702 int64_t Offset = Loop->getOperand(1).getImm();
704 Loop->eraseFromParent();
706 Loop->getOperand(1).setImm(Offset - 1);
709 // The loop trip count is a run-time value. We generate code to subtract
710 // one from the trip count, and update the loop instruction.
711 assert(Loop->getOpcode() == Hexagon::J2_loop0r && "Unexpected instruction");
712 unsigned LoopCount = Loop->getOperand(1).getReg();
713 // Check if we're done with the loop.
720 // Update the previously generated instructions with the new loop counter.
727 // Insert the new loop instruction if this is the last time the loop is
731 addMBB(Loop->getOperand(0).getMBB()).addReg(NewLoopCount);
732 // Delete the old loop instruction.
734 Loop->eraseFromParent();