L2ControlFlowGraph

class 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
fun L2ControlFlowGraph()

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
enum ZoneType : Enum<L2ControlFlowGraph.ZoneType>

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

Functions

Link copied to clipboard
fun allRegisters(): List<L2Register>

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

Link copied to clipboard
fun check(flags: Collection<KClass<out L2ControlFlowGraph.StateFlag>>)

Assert that each of the specified StateFlags has been set.

Link copied to clipboard
fun checkNot(flags: Collection<KClass<out L2ControlFlowGraph.StateFlag>>)

Assert that each of the specified StateFlags has been cleared.

Link copied to clipboard
fun clear(flags: Collection<KClass<out L2ControlFlowGraph.StateFlag>>)

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 generateOn(instructions: MutableList<L2Instruction>)

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

Link copied to clipboard
fun set(flags: Collection<KClass<out L2ControlFlowGraph.StateFlag>>)

Set each of the specified StateFlags.

Link copied to clipboard
fun simplyVisualize(): String

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

Link copied to clipboard
fun startBlock(block: L2BasicBlock)

Begin code generation in the given block.

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

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

Properties

Link copied to clipboard
val basicBlockOrder: MutableList<L2BasicBlock>

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
val state: MutableSet<KClass<out L2ControlFlowGraph.StateFlag>>

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