AvailInstructionWithIndex

abstract class AvailInstructionWithIndex(var relevantTokens: A_Tuple, val index: Int) : AvailInstruction

This abstract subclass of AvailInstruction introduces a generic index whose interpretation is left to subclasses.

Author

Mark van Gulik

Parameters

relevantTokens

The A_Tuple of A_Tokens that are associated with this instruction.

index

A generic, non-negative index to record. Subclasses interpret this value however they need.

Constructors

Link copied to clipboard
fun AvailInstructionWithIndex(relevantTokens: A_Tuple, index: Int)

Construct a new AvailInstructionWithIndex.

Functions

Link copied to clipboard
open fun fixUsageFlags(    localData: MutableList<AvailVariableAccessNote?>,     outerData: MutableList<AvailVariableAccessNote?>,     codeGenerator: AvailCodeGenerator)

The instructions of a block are being iterated over. Coordinate optimizations between instructions using localData and outerData, two lists manipulated by overrides of this method. Treat each instruction as though it is the last one in the block, and save enough information in the lists to be able to undo consequences of this assumption when a later instruction shows it to be unwarranted.

Link copied to clipboard
open fun writeLineNumberDeltasOn(encodedLineNumberDeltas: MutableList<Int>, currentLineNumber: Int): Int

Write an entry to the encoded line number deltas for each L1 instruction generated. Most AvailInstructions write a single L1 instruction, so that implementation is here.

Link copied to clipboard
abstract fun writeNybblesOn(aStream: NybbleOutputStream)

Write nybbles representing this instruction to the NybbleOutputStream.

Properties

Link copied to clipboard
val index: Int

A generic index to be interpreted by subclasses. Must be non-negative.

Link copied to clipboard
open val isOuterUse: Boolean

true iff this instruction is a use of an outer variable.

Link copied to clipboard
val lineNumber: Int

Answer which line number to say that this instruction occurs on. Use the relevantTokens as an approximation, but subclasses might be able to be more precise. Answer -1 if this instruction doesn't seem to have a location in the source associated with it.

Link copied to clipboard
var relevantTokens: A_Tuple

The tuple of tokens that contributed to producing this instruction.

Inheritors

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