Interface IStackInstructionSelector<TInstruction>
An instruction selector for a stack machine that can transfer data using either stack slots or register loads and stores.
Inherited Members
Namespace: Flame.Compiler.Target
Assembly: Flame.Compiler.dll
Syntax
public interface IStackInstructionSelector<TInstruction> : IInstructionSelector<TInstruction>
Type Parameters
Name | Description |
---|---|
TInstruction | The type of instructions to produce. |
Methods
| Improve this Doc View SourceCreateLoadRegister(ValueTag, IType)
Creates instructions that load a value from its virtual register.
Declaration
IReadOnlyList<TInstruction> CreateLoadRegister(ValueTag value, IType type)
Parameters
Type | Name | Description |
---|---|---|
ValueTag | value | The value to load. |
IType | type | The type of |
Returns
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<TInstruction> | A list of selected instructions. |
CreatePop(IType)
Creates instructions that pop a value from the stack, discarding it.
Declaration
IReadOnlyList<TInstruction> CreatePop(IType type)
Parameters
Type | Name | Description |
---|---|---|
IType | type | The type of value to pop. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<TInstruction> | A list of selected instructions. |
CreateStoreRegister(ValueTag, IType)
Creates instructions that stores a value into its virtual register.
Declaration
IReadOnlyList<TInstruction> CreateStoreRegister(ValueTag value, IType type)
Parameters
Type | Name | Description |
---|---|---|
ValueTag | value | The value to store. |
IType | type | The type of |
Returns
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<TInstruction> | A list of selected instructions. |
Pushes(InstructionPrototype)
Tells if instances of a particular instruction prototype actually push a value onto the stack. Instructions that do not push values must either ensure that their result is never used or spill their result into the appropriate virtual register on their own.
Declaration
bool Pushes(InstructionPrototype prototype)
Parameters
Type | Name | Description |
---|---|---|
InstructionPrototype | prototype | The instruction prototype to inspect. |
Returns
Type | Description |
---|---|
System.Boolean |
|
TryCreateDup(IType, out IReadOnlyList<TInstruction>)
Tries to create instructions that duplicate the top-of-stack value.
Declaration
bool TryCreateDup(IType type, out IReadOnlyList<TInstruction> dup)
Parameters
Type | Name | Description |
---|---|---|
IType | type | The type of value to duplicate. |
System.Collections.Generic.IReadOnlyList<TInstruction> | dup | A sequence of instructions that duplicate the top-of-stack value, if they can be created. |
Returns
Type | Description |
---|---|
System.Boolean |
|