Class StackInstructionStreamBuilder<TInstruction>
An instruction stream builder that manages data transfer using a combination of stack slots and explicit register loads/stores, as commonly offered by stack machines.
Inheritance
Inherited Members
Namespace: Flame.Compiler.Target
Assembly: Flame.Compiler.dll
Syntax
public class StackInstructionStreamBuilder<TInstruction> : InstructionStreamBuilder<TInstruction>
Type Parameters
Name | Description |
---|---|
TInstruction | The type of instruction to generate. |
Constructors
| Improve this Doc View SourceStackInstructionStreamBuilder(ILinearInstructionSelector<TInstruction>)
Creates a stack machine instruction stream builder.
Declaration
protected StackInstructionStreamBuilder(ILinearInstructionSelector<TInstruction> instructionSelector)
Parameters
Type | Name | Description |
---|---|---|
ILinearInstructionSelector<TInstruction> | instructionSelector | The instruction selector to use. This instruction selector must also be a stack instruction selector. |
Methods
| Improve this Doc View SourceCreate<TSelector>(TSelector)
Creates a linear instruction stream builder.
Declaration
public static StackInstructionStreamBuilder<TInstruction> Create<TSelector>(TSelector instructionSelector)
where TSelector : ILinearInstructionSelector<TInstruction>, IStackInstructionSelector<TInstruction>
Parameters
Type | Name | Description |
---|---|---|
TSelector | instructionSelector | The instruction selector to use. |
Returns
Type | Description |
---|---|
StackInstructionStreamBuilder<TInstruction> |
Type Parameters
Name | Description |
---|---|
TSelector |
GetStackContentsOnEntry(BasicBlock)
Gets the contents of the evaluation stack just before a basic block's first instruction is executed.
Declaration
protected virtual IEnumerable<ValueTag> GetStackContentsOnEntry(BasicBlock block)
Parameters
Type | Name | Description |
---|---|---|
BasicBlock | block | The basic block to inspect. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ValueTag> | A sequence of values that represent the contents of the stack. |
ShouldMaterializeOnUse(NamedInstruction)
Tells if an instruction should always be materialized when it is used rather than when it is defined.
Declaration
protected virtual bool ShouldMaterializeOnUse(NamedInstruction instruction)
Parameters
Type | Name | Description |
---|---|---|
NamedInstruction | instruction | An instruction to inspect. |
Returns
Type | Description |
---|---|
System.Boolean |
|
ToInstructionStream(BasicBlock, IReadOnlyDictionary<ValueTag, SelectedInstructions<TInstruction>>, SelectedFlowInstructions<TInstruction>)
Declaration
protected override IReadOnlyList<TInstruction> ToInstructionStream(BasicBlock block, IReadOnlyDictionary<ValueTag, SelectedInstructions<TInstruction>> instructions, SelectedFlowInstructions<TInstruction> flow)
Parameters
Type | Name | Description |
---|---|---|
BasicBlock | block | |
System.Collections.Generic.IReadOnlyDictionary<ValueTag, SelectedInstructions<TInstruction>> | instructions | |
SelectedFlowInstructions<TInstruction> | flow |
Returns
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<TInstruction> |