Class InstructionBuilder
A reference to an instruction in a control-flow graph, which can either be a named instruction that is defined directly by a basic block or an unnamed instruction included in a block's flow.
This is a mutable reference: it refers to an instruction in a control-flow graph builder and that instruction can be changed.
Inherited Members
Namespace: Flame.Compiler
Assembly: Flame.Compiler.dll
Syntax
public abstract class InstructionBuilder
Properties
| Improve this Doc View SourceArguments
Gets or sets the instruction's argument list.
Declaration
public IReadOnlyList<ValueTag> Arguments { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<ValueTag> |
Block
Gets the block that defines this instruction.
Declaration
public abstract BasicBlockBuilder Block { get; }
Property Value
Type | Description |
---|---|
BasicBlockBuilder | A basic block builder. |
Graph
Gets the graph that defines this instruction.
Declaration
public virtual FlowGraphBuilder Graph { get; }
Property Value
Type | Description |
---|---|
FlowGraphBuilder | A control-flow graph builder. |
Instruction
Gets or sets the instruction referred to by this instruction builder.
Declaration
public abstract Instruction Instruction { get; set; }
Property Value
Type | Description |
---|---|
Instruction | The instruction referred to by this builder. |
IsValid
Tells if this instruction builder is still valid. Querying or modifying invalid instruction builders results in an exception.
Declaration
public abstract bool IsValid { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Prototype
Gets the instruction's prototype.
Declaration
public InstructionPrototype Prototype { get; }
Property Value
Type | Description |
---|---|
InstructionPrototype |
ResultType
Gets the instruction's result type.
Declaration
public IType ResultType { get; }
Property Value
Type | Description |
---|---|
IType |
Methods
| Improve this Doc View SourceInsertBefore(Instruction)
Inserts a particular instruction just before this instruction. Returns the inserted instruction builder.
Declaration
public NamedInstructionBuilder InsertBefore(Instruction instruction)
Parameters
Type | Name | Description |
---|---|---|
Instruction | instruction | The instruction to insert. |
Returns
Type | Description |
---|---|
NamedInstructionBuilder | The inserted instruction. |
InsertBefore(Instruction, ValueTag)
Inserts a particular instruction just before this instruction. Returns the inserted instruction builder.
Declaration
public abstract NamedInstructionBuilder InsertBefore(Instruction instruction, ValueTag tag)
Parameters
Type | Name | Description |
---|---|---|
Instruction | instruction | The instruction to insert. |
ValueTag | tag | The tag to assign to the instruction. |
Returns
Type | Description |
---|---|
NamedInstructionBuilder | The inserted instruction. |
InsertBefore(Instruction, String)
Inserts a particular instruction just before this instruction. Returns the inserted instruction builder.
Declaration
public NamedInstructionBuilder InsertBefore(Instruction instruction, string name)
Parameters
Type | Name | Description |
---|---|---|
Instruction | instruction | The instruction to insert. |
System.String | name | The preferred name for the instruction. |
Returns
Type | Description |
---|---|
NamedInstructionBuilder | The inserted instruction. |
ReplaceInstruction(FlowGraph)
Replaces the instruction referred to by this instruction
builder with a control-flow graph that implements the
instruction. The instruction's arguments are passed to
implementation
's entry point block.
Declaration
public void ReplaceInstruction(FlowGraph implementation)
Parameters
Type | Name | Description |
---|---|---|
FlowGraph | implementation | A control-flow graph that implements the instruction. |
Remarks
Calling this method may invalidate instruction builders, including this builder. Specifically, if this builder refers to an unnamed instruction in block flow, then this builder and all other builders to unnamed instructions in that block flow may be invalidated.
ReplaceInstruction(FlowGraph, IReadOnlyList<ValueTag>)
Replaces the instruction referred to by this instruction builder with a control-flow graph that implements the instruction.
Declaration
public abstract void ReplaceInstruction(FlowGraph implementation, IReadOnlyList<ValueTag> arguments)
Parameters
Type | Name | Description |
---|---|---|
FlowGraph | implementation | A control-flow graph that implements the instruction. |
System.Collections.Generic.IReadOnlyList<ValueTag> | arguments | A list of arguments to pass to |
Remarks
Calling this method may invalidate instruction builders, including this builder. Specifically, if this builder refers to an unnamed instruction in block flow, then this builder and all other builders to unnamed instructions in that block flow may be invalidated.