EvaluationOrderGraphPass

Creates an Evaluation Order Graph (EOG) based on AST.

An EOG is an intraprocedural directed graph whose vertices are executable AST nodes and edges connect them in the order they would be executed when running the program.

An EOG always starts at the header of a method/function and ends in one (virtual) or multiple return statements. A virtual return statement with a code location of (-1,-1) is used if the actual source code does not have an explicit return statement.

The EOG is similar to the CFG ControlFlowGraphPass, but there are some subtle differences:

  • For methods without explicit return statement, EOF will have an edge to a virtual return node with line number -1 which does not exist in the original code. A CFG will always end with the last reachable statement(s) and not insert any virtual return statements.

  • EOG considers an opening blocking ("CompoundStatement", indicated by a "{") as a separate node. A CFG will rather use the first actual executable statement within the block.

  • For IF statements, EOG treats the "if" keyword and the condition as separate nodes. CFG treats this as one "if" statement.

  • EOG considers a method header as a node. CFG will consider the first executable statement of the methods as a node.

Its handleXXX functions are intentionally set as protected, in case someone wants to extend this pass and fine-tune it.

Constructors

Link copied to clipboard

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun accept(result: TranslationResult)
Link copied to clipboard
fun addSoftDependency(toAdd: Class<out Pass?>)
Link copied to clipboard
Link copied to clipboard
open override fun cleanup()
Link copied to clipboard
fun pushToEOG(node: Node)

Creates an EOG-edge between the given argument node and the saved currentEOG Edges.

Link copied to clipboard

Check if the pass requires a specific language frontend and if that frontend has been executed.

Link copied to clipboard
fun setCurrentEOGs(nodes: List<Node>)
Link copied to clipboard

Specifies, whether this pass supports this particular language. This defaults to true * and needs to be overridden if a different behaviour is wanted.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard