L2ControlFlowGraph

This is a control graph. The vertices are L2BasicBlocks, which are connected via their successor and predecessor lists.

Author

Mark van Gulik

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
abstract class StateFlag

Flags that indicate the current state of the graph.

Link copied to clipboard
class Zone

L2BasicBlocks can be grouped into zones for better visualization of the control flow graph by the L2ControlFlowGraphVisualizer. This class is instantiated from the ZoneType.createZone factory method.

Link copied to clipboard

A categorization of kinds of Zones that will be shown as subgraphs (clusters) by the L2ControlFlowGraphVisualizer.

Properties

Link copied to clipboard

The basic blocks of the graph. They're either in the order they were generated, or in a suitable order for final L2 instruction emission.

Link copied to clipboard

The current state of the graph. New control flow graphs are expected to be in SSA form.

Functions

Link copied to clipboard

Collect the list of all distinct L2Registers assigned anywhere within this control flow graph.

Link copied to clipboard
fun backwardVisit(action: (L2BasicBlock) -> Unit)

Visit the blocks of the graph in reverse order, successors before predecessors, ignoring backward branches.

Link copied to clipboard

Assert that each of the specified StateFlags has been set.

Link copied to clipboard

Assert that each of the specified StateFlags has been cleared.

Link copied to clipboard

Clear each of the specified StateFlags.

Link copied to clipboard
fun evacuateTo(destinationControlFlowGraph: L2ControlFlowGraph)

Remove all L2BasicBlocks, moving them to another L2ControlFlowGraph that is initially empty.

Link copied to clipboard
fun forwardVisit(action: (L2BasicBlock) -> Unit)

Visit the blocks of the graph in forward order, predecessors before successors, ignoring backward branches.

Link copied to clipboard

Produce the final list of instructions. Should only be called after all optimizations have been performed.

Link copied to clipboard

Set each of the specified StateFlags.

Link copied to clipboard

Answer a visualization of this L2ControlFlowGraph. This is a debug method, intended to be called via evaluation during debugging.

Link copied to clipboard

Begin code generation in the given block.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Answer a visualization of this L2ControlFlowGraph. This is a debug method, intended to be called via evaluation during debugging.