Class BasicBlockBuilder
A basic block in a mutable control-flow graph builder.
Inheritance
Implements
Inherited Members
Namespace: Flame.Compiler
Assembly: Flame.Compiler.dll
Syntax
public sealed class BasicBlockBuilder : IEquatable<BasicBlockBuilder>
Properties
| Improve this Doc View SourceFlow
Gets or sets the control flow at the end of this basic block.
Declaration
public BlockFlow Flow { get; set; }
Property Value
Type | Description |
---|---|
BlockFlow | The end-of-block control flow. |
Graph
Gets the control-flow graph builder that defines this basic block.
Declaration
public FlowGraphBuilder Graph { get; }
Property Value
Type | Description |
---|---|
FlowGraphBuilder | The control-flow graph builder. |
InstructionTags
Gets the list of all instruction tags in this basic block.
Declaration
public ImmutableList<ValueTag> InstructionTags { get; }
Property Value
Type | Description |
---|---|
System.Collections.Immutable.ImmutableList<ValueTag> | The list of all instruction tags. |
IsEntryPoint
Tells if this block is the graph's entry point.
Declaration
public bool IsEntryPoint { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsValid
Tells if this basic block builder is still valid, that is, it has not been removed from its control-flow graph builder's set of basic blocks.
Declaration
public bool IsValid { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
NamedInstructions
Gets the list of all named instructions in this basic block.
Declaration
public IEnumerable<NamedInstructionBuilder> NamedInstructions { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<NamedInstructionBuilder> | A sequence containing all named instructions. |
Parameters
Gets or sets this basic block's list of parameters.
Declaration
public ImmutableList<BlockParameter> Parameters { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Immutable.ImmutableList<BlockParameter> | The basic block's parameters. |
ParameterTags
Gets a sequence of all parameter tags defined by this basic block.
Declaration
public IEnumerable<ValueTag> ParameterTags { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ValueTag> | The basic block's parameter tags. |
Tag
Gets this basic block's tag.
Declaration
public BasicBlockTag Tag { get; }
Property Value
Type | Description |
---|---|
BasicBlockTag | The basic block's tag. |
Methods
| Improve this Doc View SourceAppendInstruction(Instruction)
Appends a new instruction to the end of this basic block. Returns the instruction builder for the inserted instruction.
Declaration
public NamedInstructionBuilder AppendInstruction(Instruction instruction)
Parameters
Type | Name | Description |
---|---|---|
Instruction | instruction | The instruction to append. |
Returns
Type | Description |
---|---|
NamedInstructionBuilder | The appended instruction. |
AppendInstruction(Instruction, ValueTag)
Appends a new instruction to the end of this basic block. Returns the instruction builder for the inserted instruction.
Declaration
public NamedInstructionBuilder AppendInstruction(Instruction instruction, ValueTag tag)
Parameters
Type | Name | Description |
---|---|---|
Instruction | instruction | The instruction to append. |
ValueTag | tag | The instruction's tag. |
Returns
Type | Description |
---|---|
NamedInstructionBuilder | The appended instruction. |
AppendInstruction(Instruction, String)
Appends a new instruction to the end of this basic block. Returns the instruction builder for the inserted instruction.
Declaration
public NamedInstructionBuilder AppendInstruction(Instruction instruction, string name)
Parameters
Type | Name | Description |
---|---|---|
Instruction | instruction | The instruction to append. |
System.String | name | The preferred name of the instruction's tag. |
Returns
Type | Description |
---|---|
NamedInstructionBuilder | The appended instruction. |
AppendParameter(BlockParameter)
Appends a new parameter to the end of this basic block's parameter list.
Declaration
public BlockParameter AppendParameter(BlockParameter parameter)
Parameters
Type | Name | Description |
---|---|---|
BlockParameter | parameter | The parameter to append. |
Returns
Type | Description |
---|---|
BlockParameter | The block parameter. |
AppendParameter(IType)
Appends a new parameter to the end of this basic block's parameter list.
Declaration
public BlockParameter AppendParameter(IType type)
Parameters
Type | Name | Description |
---|---|---|
IType | type | The type of the parameter to append. |
Returns
Type | Description |
---|---|
BlockParameter | The block parameter. |
AppendParameter(IType, ValueTag)
Appends a new parameter to the end of this basic block's parameter list.
Declaration
public BlockParameter AppendParameter(IType type, ValueTag tag)
Parameters
Type | Name | Description |
---|---|---|
IType | type | The type of the parameter to append. |
ValueTag | tag | The tag of the parameter to append. |
Returns
Type | Description |
---|---|
BlockParameter | The block parameter. |
AppendParameter(IType, String)
Appends a new parameter to the end of this basic block's parameter list.
Declaration
public BlockParameter AppendParameter(IType type, string name)
Parameters
Type | Name | Description |
---|---|---|
IType | type | The type of the parameter to append. |
System.String | name | The name of the parameter to append. |
Returns
Type | Description |
---|---|
BlockParameter | The block parameter. |
CopyInstructionsFrom(Int32, BasicBlock, IReadOnlyList<ValueTag>)
Copies all instructions in a particular basic block into this basic block. All instructions defined by the block are renamed to avoid name clashes. References to the block's parameters are substituted by a list of arguments.
Declaration
public BlockFlow CopyInstructionsFrom(int insertionIndex, BasicBlock block, IReadOnlyList<ValueTag> arguments)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | insertionIndex | The instruction at which to insert |
BasicBlock | block | The block to copy instructions from. |
System.Collections.Generic.IReadOnlyList<ValueTag> | arguments | The arguments to feed to the |
Returns
Type | Description |
---|---|
BlockFlow |
|
Equals(BasicBlockBuilder)
Tests if this basic block equals another basic block.
Declaration
public bool Equals(BasicBlockBuilder other)
Parameters
Type | Name | Description |
---|---|---|
BasicBlockBuilder | other | The other basic block. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
InsertInstruction(Int32, Instruction)
Appends a new instruction to the end of this basic block. Returns the instruction builder for the inserted instruction.
Declaration
public NamedInstructionBuilder InsertInstruction(int index, Instruction instruction)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to insert the instruction at. |
Instruction | instruction | The instruction to insert. |
Returns
Type | Description |
---|---|
NamedInstructionBuilder | The inserted instruction. |
InsertInstruction(Int32, Instruction, ValueTag)
Inserts a new instruction into this basic block's list of instructions. Returns the instruction builder for the inserted instruction.
Declaration
public NamedInstructionBuilder InsertInstruction(int index, Instruction instruction, ValueTag tag)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to insert the instruction at. |
Instruction | instruction | The instruction to insert. |
ValueTag | tag | The instruction's tag. |
Returns
Type | Description |
---|---|
NamedInstructionBuilder | The inserted instruction. |
InsertInstruction(Int32, Instruction, String)
Appends a new instruction to the end of this basic block. Returns the instruction builder for the inserted instruction.
Declaration
public NamedInstructionBuilder InsertInstruction(int index, Instruction instruction, string name)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to insert the instruction at. |
Instruction | instruction | The instruction to insert. |
System.String | name | The preferred name of the instruction's tag. |
Returns
Type | Description |
---|---|
NamedInstructionBuilder | The inserted instruction. |
RemoveInstruction(ValueTag)
Removes the instruction with a particular tag from this basic block.
Declaration
public void RemoveInstruction(ValueTag tag)
Parameters
Type | Name | Description |
---|---|---|
ValueTag | tag | The tag of the instruction to remove. |
Operators
| Improve this Doc View SourceImplicit(BasicBlockBuilder to BasicBlockTag)
Implicitly converts a block to its tag.
Declaration
public static implicit operator BasicBlockTag(BasicBlockBuilder block)
Parameters
Type | Name | Description |
---|---|---|
BasicBlockBuilder | block | The block to convert. |
Returns
Type | Description |
---|---|
BasicBlockTag |