L2RegisterColorer

class L2RegisterColorer(controlFlowGraph: L2ControlFlowGraph)

Used to compute which registers can use the same storage due to not being active at the same time. This is called register coloring.

Author

Mark van Gulik

Parameters

controlFlowGraph

Constructors

Link copied to clipboard
fun L2RegisterColorer(controlFlowGraph: L2ControlFlowGraph)

Construct a new register colorer for the given control flow graph.

Functions

Link copied to clipboard
fun coalesceNoninterferingMoves()

Now that the interference graph has been constructed, merge together any non-interfering nodes that are connected by a move.

Link copied to clipboard
fun computeColors()

Determine colors for all registers. We use a simple coloring algorithm here, since both L2 and the JVM have an effectively unbounded number of virtual registers, and we're merely interested in keeping the color count as reasonably close to minimal as we can.

Link copied to clipboard
fun computeInterferenceGraph()

Calculate the register interference graph.

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