L2Register

abstract class L2Register(val uniqueValue: Int) : L2Entity

L2Register models the conceptual use of a register by a level two Avail operation in the L2Generator.

Author

Mark van Gulik

Todd L Smith

Parameters

uniqueValue

A value used to distinguish distinct registers.

Constructors

Link copied to clipboard
fun L2Register(uniqueValue: Int)

Construct a new L2BoxedRegister.

Types

Link copied to clipboard
enum RegisterKind : Enum<L2Register.RegisterKind>

One of the kinds of registers that Level Two supports.

Functions

Link copied to clipboard
fun addDefinition(write: L2WriteOperand<*>)

Record this L2WriteOperand in my set of defining write operands.

Link copied to clipboard
fun addUse(read: L2ReadOperand<*>)

Capture another L2ReadOperand of an emitted L2Instruction that uses this register.

Link copied to clipboard
abstract fun copyAfterColoring(): L2Register

Answer a new register like this one, but where the uniqueValue has been set to the finalIndex.

Link copied to clipboard
abstract fun copyForRegenerator(regenerator: L2Regenerator): L2Register

Answer a copy of the receiver. Subclasses can be covariantly stronger in the return type.

Link copied to clipboard
abstract fun copyForTranslator(generator: L2Generator): L2Register

Answer a new register like this one.

Link copied to clipboard
fun definition(): L2WriteOperand<*>

Answer the L2WriteOperand of an L2Instruction which assigns this register in the SSA control flow graph. It must have been assigned already, and there must be exactly one (when the control flow graph is in SSA form).

Link copied to clipboard
fun definitions(): Collection<L2WriteOperand<*>>

Answer the L2WriteOperands which assign this register in the control flow graph, which is not necessarily in SSA form. It must be non-empty.

Link copied to clipboard
fun finalIndex(): Int

Answer the coloring number to be used by the interpreter at runtime to identify the storage location of a register.

Link copied to clipboard
fun namePrefix(): String

Answer the prefix for non-constant registers. This is used only for register printing.

Link copied to clipboard
fun removeDefinition(write: L2WriteOperand<*>)

Remove the given L2WriteOperand as one of the writers to this register.

Link copied to clipboard
fun removeUse(read: L2ReadOperand<*>)

Drop a use of this register by an L2ReadOperand of an L2Instruction that is now dead.

Link copied to clipboard
fun setFinalIndex(theFinalIndex: Int)

Set the coloring number to be used by the interpreter at runtime to identify the storage location of an L2Register.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun uses(): Set<L2ReadOperand<*>>

Answer the Set of L2ReadOperands that read from this register. Callers must not modify the returned collection.

Properties

Link copied to clipboard
abstract val registerKind: L2Register.RegisterKind

Answer the kind of register this is. Different register kinds are allocated from different virtual banks, and do not interfere in terms of register liveness computation.

Link copied to clipboard
val uniqueValue: Int

A value used to distinguish distinct registers.

Inheritors

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