Struct BasicBlock
A basic block in a control-flow graph.
Implements
Inherited Members
Namespace: Flame.Compiler
Assembly: Flame.Compiler.dll
Syntax
public struct BasicBlock : IEquatable<BasicBlock>
Properties
| Improve this Doc View SourceFlow
Gets the control flow at the end of this basic block.
Declaration
public BlockFlow Flow { get; }
Property Value
Type | Description |
---|---|
BlockFlow | The end-of-block control flow. |
Graph
Gets the control-flow graph in which this block resides.
Declaration
public FlowGraph Graph { get; }
Property Value
Type | Description |
---|---|
FlowGraph | A control-flow graph. |
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 |
NamedInstructions
Gets the list of all named instructions in this basic block.
Declaration
public IEnumerable<NamedInstruction> NamedInstructions { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<NamedInstruction> | The list of all named instructions. |
Parameters
Gets this basic block's list of parameters.
Declaration
public ImmutableList<BlockParameter> Parameters { get; }
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 a new basic block in a new control-flow graph.
Declaration
public NamedInstruction AppendInstruction(Instruction instruction)
Parameters
Type | Name | Description |
---|---|---|
Instruction | instruction | The instruction to append. |
Returns
Type | Description |
---|---|
NamedInstruction | The appended instruction. |
AppendInstruction(Instruction, ValueTag)
Appends a new instruction to the end of this basic block. Returns a new basic block in a new control-flow graph.
Declaration
public NamedInstruction AppendInstruction(Instruction instruction, ValueTag tag)
Parameters
Type | Name | Description |
---|---|---|
Instruction | instruction | The instruction to append. |
ValueTag | tag | The tag for the instruction. |
Returns
Type | Description |
---|---|
NamedInstruction | The appended instruction. |
AppendInstruction(Instruction, String)
Appends a new instruction to the end of this basic block. Returns a new basic block in a new control-flow graph.
Declaration
public NamedInstruction 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 |
---|---|
NamedInstruction | The appended instruction. |
AppendParameter(BlockParameter)
Appends a new parameter to the end of this basic block's parameter list. Returns a new basic block in a new control-flow graph.
Declaration
public BasicBlock AppendParameter(BlockParameter parameter)
Parameters
Type | Name | Description |
---|---|---|
BlockParameter | parameter | The parameter to append. |
Returns
Type | Description |
---|---|
BasicBlock | A new basic block in a new control-flow graph. |
Equals(BasicBlock)
Tests if this basic block equals another basic block.
Declaration
public bool Equals(BasicBlock other)
Parameters
Type | Name | Description |
---|---|---|
BasicBlock | 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)
Inserts a new instruction into this basic block's list of instructions. Returns a new basic block in a new control-flow graph.
Declaration
public NamedInstruction InsertInstruction(int index, Instruction instruction)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index at which the instruction is to be inserted. |
Instruction | instruction | The instruction to insert. |
Returns
Type | Description |
---|---|
NamedInstruction | The inserted instruction. |
InsertInstruction(Int32, Instruction, ValueTag)
Inserts a new instruction into this basic block's list of instructions. Returns a new basic block in a new control-flow graph.
Declaration
public NamedInstruction InsertInstruction(int index, Instruction instruction, ValueTag tag)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index at which the instruction is to be inserted. |
Instruction | instruction | The instruction to insert. |
ValueTag | tag | The tag for the instruction. |
Returns
Type | Description |
---|---|
NamedInstruction | The inserted instruction. |
InsertInstruction(Int32, Instruction, String)
Inserts a new instruction into this basic block's list of instructions. Returns a new basic block in a new control-flow graph.
Declaration
public NamedInstruction InsertInstruction(int index, Instruction instruction, string name)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index at which the instruction is to be inserted. |
Instruction | instruction | The instruction to insert. |
System.String | name | The preferred name of the instruction's tag. |
Returns
Type | Description |
---|---|
NamedInstruction | The inserted instruction. |
RemoveInstruction(ValueTag)
Removes the instruction with a particular tag from this basic block. Returns a new basic block in a new control-flow graph.
Declaration
public BasicBlock RemoveInstruction(ValueTag tag)
Parameters
Type | Name | Description |
---|---|---|
ValueTag | tag | The tag of the instruction to remove. |
Returns
Type | Description |
---|---|
BasicBlock | A new basic block in a new control-flow graph. |
WithFlow(BlockFlow)
Creates a new basic block in a new control-flow graph that has a particular flow.
Declaration
public BasicBlock WithFlow(BlockFlow flow)
Parameters
Type | Name | Description |
---|---|---|
BlockFlow | flow | The new flow. |
Returns
Type | Description |
---|---|
BasicBlock | A new basic block in a new control-flow graph. |
WithParameters(IReadOnlyList<BlockParameter>)
Creates a new basic block in a new control-flow graph that has a particular list of parameters.
Declaration
public BasicBlock WithParameters(IReadOnlyList<BlockParameter> parameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IReadOnlyList<BlockParameter> | parameters | The new parameters. |
Returns
Type | Description |
---|---|
BasicBlock | A new basic block in a new control-flow graph. |
WithParameters(ImmutableList<BlockParameter>)
Creates a new basic block in a new control-flow graph that has a particular list of parameters.
Declaration
public BasicBlock WithParameters(ImmutableList<BlockParameter> parameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Immutable.ImmutableList<BlockParameter> | parameters | The new parameters. |
Returns
Type | Description |
---|---|
BasicBlock | A new basic block in a new control-flow graph. |
Operators
| Improve this Doc View SourceImplicit(BasicBlock to BasicBlockTag)
Implicitly converts a block to its tag.
Declaration
public static implicit operator BasicBlockTag(BasicBlock block)
Parameters
Type | Name | Description |
---|---|---|
BasicBlock | block | The block to convert. |
Returns
Type | Description |
---|---|
BasicBlockTag |