ILGPU  0.9.0
ILGPU.IR.BasicBlock Class Reference

Represents a single basic block. More...

Inheritance diagram for ILGPU.IR.BasicBlock:
ILGPU.IR.ValueParent ILGPU.IR.IDumpable ILGPU.IR.Node ILGPU.IR.INode ILGPU.IR.ILocation ILGPU.IR.IDumpable

Classes

class  Builder
 Represents a basic block builder. More...
 
struct  Enumerator
 An enumerator for values. More...
 
struct  SuccessorsProvider
 A provider that uses registered successors and predecessors of a block. More...
 
struct  TerminatorSuccessorsProvider
 A provider that uses terminators to determine the successors of a block. More...
 
struct  ValueEntry
 Represents a value reference within a single basic block. More...
 

Public Member Functions

delegate void ValueVisitor< in TValue > (TValue value)
 Represents a visitor for values. More...
 
void AssertNoControlFlowUpdate ()
 Asserts that no control-flow update has happened and the predecessor and successor relations are still up to date. More...
 
ReadOnlySpan< BasicBlockGetPredecessors< TDirection > ()
 Determines the actual predecessors based on the specified direction. More...
 
ReadOnlySpan< BasicBlockGetSuccessors< TDirection > ()
 Determines the actual successors based on the specified direction. More...
 
bool HasSideEffects ()
 Checks whether this block has side effects. More...
 
GetTerminatorAs< T > ()
 Returns the terminator converted to the given type. More...
 
override void Dump (TextWriter textWriter)
 Dumps this block to the given text writer. More...
 
void ForEachValue< TValue > (ValueVisitor< TValue > visitor)
 Executes the given visitor for each value in this scope. More...
 
Enumerator GetEnumerator ()
 Returns a value enumerator. More...
 
- Public Member Functions inherited from ILGPU.IR.Node
virtual string FormatErrorMessage (string message)
 Formats an error message to include specific exception information. More...
 
string ToReferenceString ()
 Returns the string representation of this node as reference. More...
 
override string ToString ()
 Returns the string representation of this node. More...
 

Public Attributes

ReadOnlySpan< BasicBlockPredecessors => GetPredecessors<Forwards>()
 The list of predecessors (see Backwards). More...
 
ReadOnlySpan< BasicBlockSuccessors => GetSuccessors<Forwards>()
 The list of successors (see Forwards). More...
 
ReadOnlySpan< BasicBlockCurrentSuccessors
 The current list of successor blocks. More...
 
int Count => values.Count
 Returns the number of values. More...
 
ValueReference this[int index] => values[index]
 Returns the i-th value. More...
 
- Public Attributes inherited from ILGPU.IR.ValueParent
bool IsBasicBlock => this is BasicBlock
 Returns true if this parent container is a block. More...
 
bool IsMethod => this is Method
 Returns true if this container is method. More...
 

Protected Member Functions

override string ToPrefixString ()
 
- Protected Member Functions inherited from ILGPU.IR.ValueParent
 ValueParent (Location location)
 Constructs a new value parent. More...
 
- Protected Member Functions inherited from ILGPU.IR.Node
 Node (Location location)
 Constructs a new node that is marked as replaceable. More...
 
void InferLocation< T > (ReadOnlySpan< T > elements)
 Infers the location (if required) of the current node. More...
 

Properties

Method Method [get]
 Returns the parent IR method. More...
 
string Name [get]
 Returns the (meaningless) name. More...
 
TerminatorValue Terminator [get]
 Returns the current terminator. More...
 
int BlockIndex [get]
 Returns the associated block index that is updated during traversal and can be used to map blocks to values using fast array lookups. More...
 
- Properties inherited from ILGPU.IR.Node
Location Location [get]
 Returns the associated location. More...
 
NodeId Id [get]
 Returns the unique node id. More...
 
- Properties inherited from ILGPU.IR.INode
NodeId Id [get]
 Returns the unique node id. More...
 
Location Location [get]
 Returns the associated location. More...
 

Detailed Description

Represents a single basic block.

Member Function Documentation

void ILGPU.IR.BasicBlock.AssertNoControlFlowUpdate ( )

Asserts that no control-flow update has happened and the predecessor and successor relations are still up to date.

This operation is only available in debug mode.

override void ILGPU.IR.BasicBlock.Dump ( TextWriter  textWriter)

Dumps this block to the given text writer.

Implements ILGPU.IR.IDumpable.

void ILGPU.IR.BasicBlock.ForEachValue< TValue > ( ValueVisitor< TValue >  visitor)

Executes the given visitor for each value in this scope.

Template Parameters
TValueThe value to match.
Parameters
visitorThe visitor.
Type Constraints
TValue :Value 
Enumerator ILGPU.IR.BasicBlock.GetEnumerator ( )

Returns a value enumerator.

Returns
The resolved enumerator.
ReadOnlySpan<BasicBlock> ILGPU.IR.BasicBlock.GetPredecessors< TDirection > ( )

Determines the actual predecessors based on the specified direction.

Template Parameters
TDirectionThe control-flow direction.
Type Constraints
TDirection :IControlFlowDirection 
ReadOnlySpan<BasicBlock> ILGPU.IR.BasicBlock.GetSuccessors< TDirection > ( )

Determines the actual successors based on the specified direction.

Template Parameters
TDirectionThe control-flow direction.
Type Constraints
TDirection :IControlFlowDirection 
T ILGPU.IR.BasicBlock.GetTerminatorAs< T > ( )

Returns the terminator converted to the given type.

Template Parameters
TThe target terminator type.
Returns
The converted terminator value.
Type Constraints
T :TerminatorValue 
bool ILGPU.IR.BasicBlock.HasSideEffects ( )

Checks whether this block has side effects.

Returns
True, if this block has side effects.
override string ILGPU.IR.BasicBlock.ToPrefixString ( )
protectedvirtual

Implements ILGPU.IR.Node.

delegate void ILGPU.IR.BasicBlock.ValueVisitor< in TValue > ( TValue  value)

Represents a visitor for values.

Template Parameters
TValueThe value type.
Parameters
valueThe value to visit.
Type Constraints
TValue :Value 

Member Data Documentation

int ILGPU.IR.BasicBlock.Count => values.Count

Returns the number of values.

ReadOnlySpan<BasicBlock> ILGPU.IR.BasicBlock.CurrentSuccessors
Initial value:
=>
Terminator is null
? ReadOnlySpan<BasicBlock>.Empty
: Terminator.Targets

The current list of successor blocks.

ReadOnlySpan<BasicBlock> ILGPU.IR.BasicBlock.Predecessors => GetPredecessors<Forwards>()

The list of predecessors (see Backwards).

ReadOnlySpan<BasicBlock> ILGPU.IR.BasicBlock.Successors => GetSuccessors<Forwards>()

The list of successors (see Forwards).

ValueReference ILGPU.IR.BasicBlock.this[int index] => values[index]

Returns the i-th value.

Parameters
indexThe value index.
Returns
The resolved value reference.

Property Documentation

int ILGPU.IR.BasicBlock.BlockIndex
get

Returns the associated block index that is updated during traversal and can be used to map blocks to values using fast array lookups.

Method ILGPU.IR.BasicBlock.Method
get

Returns the parent IR method.

string ILGPU.IR.BasicBlock.Name
get

Returns the (meaningless) name.

TerminatorValue ILGPU.IR.BasicBlock.Terminator
get

Returns the current terminator.


The documentation for this class was generated from the following file: