Class ControlFlowGraphPass

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

    public class ControlFlowGraphPass
    extends java.lang.Object
    implements 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 interface Pass
      • getLang

        public LanguageFrontend getLang()
        Description copied from interface: Pass
        We do not want the passes to depend on a language frontend
        Specified by:
        getLang in interface Pass
        Returns:
        might be null, as it is not designed to be used anymore
      • setLang

        public void setLang​(LanguageFrontend lang)
        Description copied from interface: Pass
        We do not want the passes to depend on a language frontend
        Specified by:
        setLang in interface Pass
      • addTodo

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

        public void addTodo​(int index,
                            Statement... stmts)
        Adds a statement to this.remaining, omitting null.
        Parameters:
        index -
        stmts -