Class ControlFlowGraphPass

  • All Implemented Interfaces:
    java.util.function.Consumer<TranslationResult>

    public class ControlFlowGraphPass
    extends Pass
    Creates a simple control flow graph (CFG) based on AST.

    The CFG is a directed cyclic graph with Node representing statements and edges representing the program control flow.

    • Return statements will have no successors.
    • Branch statements (if/switch/exception traps) will have multiple successors.
    • Simple statements will have their following statement as sole successor
    • break / continue will create respective edges
    • Constructor Detail

      • ControlFlowGraphPass

        public ControlFlowGraphPass()
    • Method Detail

      • cleanup

        public void cleanup()
        Specified by:
        cleanup in class Pass
      • addTodo

        public void addTodo​(int index,
                            java.util.List<Statement> stmts)
      • addTodo

        public void addTodo​(int index,
                            Statement... statements)
        Adds statements to this.remaining, omitting null.
        Parameters:
        index - the index
        statements - the statements to add