L2ReadOperand

abstract class L2ReadOperand<R : L2Register> : L2Operand

L2ReadOperand abstracts the capabilities of actual register read operands.

Author

Mark van Gulik

Todd L Smith

Parameters

R

The subclass of L2Register.

semanticValue

The L2SemanticValue that is being read when an L2Instruction uses this L2Operand.

restriction

The TypeRestriction that bounds the value being read.

register

The L2Register being read by this operand.

Functions

Link copied to clipboard
open fun addDestinationRegistersTo(destinationRegisters: MutableList<L2Register>)

Move any registers used as destinations within me into the provided list.

Link copied to clipboard
open override fun addReadsTo(readOperands: MutableList<L2ReadOperand<*>>)

Capture all L2ReadOperands within this operand into the provided List.

Link copied to clipboard
open override fun addSourceRegistersTo(sourceRegisters: MutableList<L2Register>)

Move any registers used as sources within me into the provided list.

Link copied to clipboard
open fun addWritesTo(writeOperands: MutableList<L2WriteOperand<*>>)

Capture all L2WriteOperands within this operand into the provided List.

Link copied to clipboard
open fun adjustCloneForInstruction(theInstruction: L2Instruction)

This is a freshly cloned operand. Adjust it for use in the given L2Instruction. Note that the new instruction has not yet been installed into an L2BasicBlock.

Link copied to clipboard
open override fun appendTo(builder: StringBuilder)

Write a description of this operand to the given StringBuilder.

Link copied to clipboard
fun appendWithWarningsTo(    builder: StringBuilder,     indent: Int,     warningStyleChange: (Boolean) -> Unit)

Append a textual representation of this operand to the provided StringBuilder. If a style change is appropriate while building the string, invoke the warningStyleChange lambda with true to enable the warning style, and false to turn it off again.

Link copied to clipboard
open fun assertHasBeenEmitted()

Assert that this operand knows its instruction, which should always be the case if the instruction has already been emitted.

Link copied to clipboard
open override fun clone(): L2Operand
Link copied to clipboard
fun constantOrNull(): AvailObject?

Answer this read's type restriction's constant value (i.e., the exact value that this read is guaranteed to produce), or null if such a constraint is not available.

Link copied to clipboard
abstract fun copyForRegister(newRegister: L2Register): L2ReadOperand<R>

Create an L2ReadOperand like this one, but with a different register.

Link copied to clipboard
abstract fun createNewRegister(): R

Create a new register of a suitable type for this read.

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

Answer the L2WriteOperand that provided the value that this operand is reading. The control flow graph must be in SSA form.

Link copied to clipboard
fun definitionSkippingMoves(bypassImmutables: Boolean): L2Instruction

Answer the L2Instruction which generates the value that will populate this register. Skip over move instructions. The containing graph must be in SSA form.

Link copied to clipboard
abstract fun dispatchOperand(dispatcher: L2OperandDispatcher)

Dispatch this L2Operand to the provided L2OperandDispatcher.

Link copied to clipboard
fun finalIndex(): Int

Answer the L2Register's finalIndex.

Link copied to clipboard
fun findSourceInformation(): Pair<Set<L2SemanticValue>, TypeRestriction>

Find the set of L2SemanticValues and TypeRestriction leading to this read operand. The control flow graph is not necessarily in SSA form, so the underlying register may have multiple definitions to choose from, some of which are not in this read's history.

Link copied to clipboard
open override fun instructionWasAdded(manifest: L2ValueManifest)

This is an operand of the given instruction, which was just added to its basic block. Its instruction was just set.

Link copied to clipboard
open override fun instructionWasInserted(newInstruction: L2Instruction)

This is an operand of the given instruction, which was just inserted into its basic block as part of an optimization pass.

Link copied to clipboard
open override fun instructionWasRemoved()

This is an operand of the given instruction, which was just removed from its basic block.

Link copied to clipboard
fun originalBoxedWriteSkippingMoves(bypassImmutables: Boolean): L2WriteBoxedOperand

Answer the L2WriteBoxedOperand which produces the value that will populate this register. Skip over move instructions. Also skip over boxing and unboxing operations that don't alter the value. The containing graph must be in SSA form.

Link copied to clipboard
open override fun postOptimizationCleanup()

Now that chunk optimization has completed, remove information from this instruction that will no longer be needed in the finished chunk. Note that during subsequent inlining of this chunk at a call site, the type and synonym information will be reconstructed without too much cost.

Link copied to clipboard
fun register(): R

Answer this read's L2Register.

Link copied to clipboard
fun registerString(): String

Answer a String that describes this operand for debugging.

Link copied to clipboard
open override fun replaceRegisters(registerRemap: Map<L2Register, L2Register>, theInstruction: L2Instruction)

Replace occurrences in this operand of each register that is a key of this map with the register that is the corresponding value. Do nothing to registers that are not keys of the map. Update all secondary structures, such as the instruction's source/destination collections.

Link copied to clipboard
fun restriction(): TypeRestriction

Answer the type restriction for this register read.

Link copied to clipboard
open fun semanticValue(): L2SemanticValue

Answer the L2SemanticValue being read.

Link copied to clipboard
open fun setInstruction(theInstruction: L2Instruction?)

Set the instructionOrNull field.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun transformEachRead(transformer: (L2ReadOperand<*>) -> L2ReadOperand<*>): L2ReadOperand<*>

Transform each L2ReadOperand through the given lambda, producing either a new L2Operand of the same type, or the receiver.

Link copied to clipboard
fun type(): A_Type

Answer this read's type restriction's basic type.

Properties

Link copied to clipboard
val instruction: L2Instruction

Answer the L2Instruction containing this operand.

Link copied to clipboard
val instructionHasBeenEmitted: Boolean

Answer whether this write operand has been written yet as the destination of some instruction.

Link copied to clipboard
val isMisconnected: Boolean

Answer whether this operand is misconnected to its L2Instruction.

Link copied to clipboard
abstract val operandType: L2OperandType

Answer this operand's L2OperandType.

Link copied to clipboard
abstract val registerKind: L2Register.RegisterKind

Answer the RegisterKind of register that is read by this L2ReadOperand.

Inheritors

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