Class Loop


  • public class Loop
    extends Object
    A (natural) loop in Jimple. A back-edge (t,h) is a control-flow edge for which h dominates t. In this case h is the header and the loop consists of all statements s which reach t without passing through h.
    Author:
    Eric Bodden
    • Field Detail

      • header

        protected final Stmt header
      • backJump

        protected final Stmt backJump
      • loopStatements

        protected final List<Stmt> loopStatements
    • Method Detail

      • getHead

        public Stmt getHead()
        Returns:
        the loop head
      • getBackJumpStmt

        public Stmt getBackJumpStmt()
        Returns the statement that jumps back to the head, thereby constituing the loop.
      • getLoopStatements

        public List<Stmt> getLoopStatements()
        Returns:
        all statements of the loop, including the header; the header will be the first element returned and then the other statements follow in the natural ordering of the loop
      • getLoopExits

        public Collection<Stmt> getLoopExits()
        Returns all loop exists. A loop exit is a statement which has a successor that is not contained in the loop.
      • targetsOfLoopExit

        public Collection<Stmt> targetsOfLoopExit​(Stmt loopExit)
        Computes all targets of the given loop exit, i.e. statements that the exit jumps to but which are not part of this loop.
      • loopsForever

        public boolean loopsForever()
        Returns true if this loop certainly loops forever, i.e. if it has not exit.
        See Also:
        getLoopExits()
      • hasSingleExit

        public boolean hasSingleExit()
        Returns true if this loop has a single exit statement.
        See Also:
        getLoopExits()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object