ILGPU  0.9.0
ILGPU.IR.Value Class Referenceabstract

Represents a basic intermediate-representation value. It is the base class for all values in the scope of this IR. More...

Inheritance diagram for ILGPU.IR.Value:
ILGPU.IR.Node ILGPU.IR.IValue ILGPU.IR.INode ILGPU.IR.INode ILGPU.IR.ILocation ILGPU.IR.IDumpable ILGPU.IR.ILocation ILGPU.IR.IDumpable ILGPU.IR.Values.ArithmeticValue ILGPU.IR.Values.CastValue ILGPU.IR.Values.ClassValue ILGPU.IR.Values.CompareValue ILGPU.IR.Values.Conditional ILGPU.IR.Values.ConstantNode ILGPU.IR.Values.ConvertValue ILGPU.IR.Values.HandleValue ILGPU.IR.Values.LoadFieldAddress ILGPU.IR.Values.MemoryValue ILGPU.IR.Values.MethodCall ILGPU.IR.Values.NewView ILGPU.IR.Values.Parameter ILGPU.IR.Values.PhiValue ILGPU.IR.Values.PointerValue ILGPU.IR.Values.StructureOperationValue ILGPU.IR.Values.StructureValue ILGPU.IR.Values.TerminatorValue ILGPU.IR.Values.UndefinedValue ILGPU.IR.Values.ViewPropertyValue

Public Member Functions

Use GetFirstUse ()
 Resolves the first use. More...
 
Value GetFirstUseNode ()
 Resolves the first use as value. More...
 
abstract void Accept< T > (T visitor)
 Accepts a value visitor. More...
 
void Replace (Value other)
 Replaces this value with the given value. More...
 
Value Resolve ()
 Resolves the actual value with respect to replacement information. More...
 
ResolveAs< T > ()
 Resolves the actual value with respect to replacement information. More...
 
bool Equals (Value other)
 Returns true if the given value is the same value. More...
 
ReadOnlySpan< ValueReference >.Enumerator GetEnumerator ()
 Returns an enumerator to enumerate all child values. More...
 
sealed override string ToString ()
 Returns the string representation of this node. More...
 
override bool Equals (object obj)
 Returns true if the given object is equal to the current value. More...
 
override int GetHashCode ()
 Returns the hash code of this value. More...
 
- Public Member Functions inherited from ILGPU.IR.Node
virtual string FormatErrorMessage (string message)
 Formats an error message to include specific exception information. More...
 
virtual void Dump (TextWriter textWriter)
 Dumps this method to the given text writer. 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

const ValueFlags DefaultFlags = ValueFlags.None
 The default value flags. More...
 
Method Method
 Returns the parent method. More...
 
BasicValueType BasicValueType
 Returns the associated basic value type. More...
 
bool CanBeReplaced
 Returns true if the current value can be replaced. More...
 
bool CanHaveUses
 Returns true if the current value can have uses. More...
 
bool HasStaticType
 Returns true if the current value has a static type. More...
 
bool IsSealed
 Returns true if the current value has been sealed. More...
 
bool IsReplaced => CanBeReplaced & Replacement != this
 Returns true if the current value has been replaced. More...
 
ReadOnlySpan< ValueReferenceNodes => values
 Returns all child values. More...
 
int Count => values.Count
 Returns the number of child values. More...
 
int AllNumUses => uses.Count
 Returns the total number of all associated uses. More...
 
UseCollection Uses => new UseCollection(this, uses)
 Returns all current uses (to non-replaced values). More...
 
ValueReference this[int index] => Nodes[index]
 Accesses the child value with the given index. More...
 

Protected Member Functions

 Value (in ValueInitializer initializer)
 Constructs a new value that is marked as replaceable. More...
 
 Value (in ValueInitializer initializer, TypeNode staticType)
 Constructs a new value that is marked as replaceable. More...
 
 Value (in ValueInitializer initializer, ValueFlags valueFlags)
 Constructs a new value that is marked as replaceable. More...
 
 Value (in ValueInitializer initializer, ValueFlags valueFlags, TypeNode staticType)
 Constructs a new value that is marked as replaceable. More...
 
void InvalidateType ()
 Invalidates the current type and enforces a re-computation of the current type. More...
 
virtual TypeNode ComputeType (in ValueInitializer initializer)
 Computes the current type. More...
 
void VerifyNotSealed ()
 Verifies that the this value is not sealed. More...
 
void Seal ()
 Seals this value. More...
 
void Seal (ValueReference value1)
 Seals this value. More...
 
void Seal (ValueReference value1, ValueReference value2)
 Seals this value. More...
 
void Seal (ValueReference value1, ValueReference value2, ValueReference value3)
 Seals this value. More...
 
void Seal (ref ValueList valueList)
 Seals this value. More...
 
virtual string ToArgString ()
 Returns the argument string (operation arguments) of this node. 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...
 
abstract string ToPrefixString ()
 Returns the prefix string (operation name) of this node. More...
 

Properties

abstract ValueKind ValueKind [get]
 Returns the current value kind. More...
 
BasicBlock BasicBlock [get, set]
 Returns the parent basic block. More...
 
TypeNode Type [get]
 Returns the associated type. More...
 
ValueFlags ValueFlags [get]
 Returns the associated value flags. More...
 
Value Replacement [get]
 Returns the replacement of this value (if any). 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...
 
- Properties inherited from ILGPU.IR.IValue
ValueKind ValueKind [get]
 Returns the current value kind. More...
 
TypeNode Type [get]
 Returns the associated type information. More...
 
BasicBlock BasicBlock [get]
 Returns the parent basic block. More...
 
BasicValueType BasicValueType [get]
 Returns the associated basic value type. More...
 
ReadOnlySpan< ValueReferenceNodes [get]
 Returns all associated nodes. More...
 
UseCollection Uses [get]
 Returns all associated uses. More...
 

Detailed Description

Represents a basic intermediate-representation value. It is the base class for all values in the scope of this IR.

Constructor & Destructor Documentation

ILGPU.IR.Value.Value ( in ValueInitializer  initializer)
protected

Constructs a new value that is marked as replaceable.

Parameters
initializerThe value initializer.
ILGPU.IR.Value.Value ( in ValueInitializer  initializer,
TypeNode  staticType 
)
protected

Constructs a new value that is marked as replaceable.

Parameters
initializerThe value initializer.
staticTypeThe static type.
ILGPU.IR.Value.Value ( in ValueInitializer  initializer,
ValueFlags  valueFlags 
)
protected

Constructs a new value that is marked as replaceable.

Parameters
initializerThe value initializer.
valueFlagsThe value flags.
ILGPU.IR.Value.Value ( in ValueInitializer  initializer,
ValueFlags  valueFlags,
TypeNode  staticType 
)
protected

Constructs a new value that is marked as replaceable.

Parameters
initializerThe value initializer.
valueFlagsThe value flags.
staticTypeThe static type (if any).

Member Function Documentation

abstract void ILGPU.IR.Value.Accept< T > ( visitor)
pure virtual

Accepts a value visitor.

Template Parameters
TThe type of the visitor.
Parameters
visitorThe visitor.

Implements ILGPU.IR.IValue.

Implemented in ILGPU.IR.Values.SetField, ILGPU.IR.Values.GetField, ILGPU.IR.Values.StructureValue, ILGPU.IR.Values.BuilderTerminator, ILGPU.IR.Values.SwitchBranch, ILGPU.IR.Values.IntAsFloatCast, ILGPU.IR.Values.SubWarpShuffle, ILGPU.IR.Values.FloatAsIntCast, ILGPU.IR.Values.IfBranch, ILGPU.IR.Values.WarpShuffle, ILGPU.IR.Values.LaneIdxValue, ILGPU.IR.Values.TernaryArithmeticValue, ILGPU.IR.Values.ViewCast, ILGPU.IR.Values.WarpSizeValue, ILGPU.IR.Values.PhiValue, ILGPU.IR.Values.Store, ILGPU.IR.Values.GroupDimensionValue, ILGPU.IR.Values.Broadcast, ILGPU.IR.Values.SetArrayElement, ILGPU.IR.Values.StringValue, ILGPU.IR.Values.UnconditionalBranch, ILGPU.IR.Values.AddressSpaceCast, ILGPU.IR.Values.LoadFieldAddress, ILGPU.IR.Values.SwitchPredicate, ILGPU.IR.Values.BinaryArithmeticValue, ILGPU.IR.Values.GridDimensionValue, ILGPU.IR.Values.Load, ILGPU.IR.Values.AtomicCAS, ILGPU.IR.Values.GetArrayElement, ILGPU.IR.Values.GroupIndexValue, ILGPU.IR.Values.PrimitiveValue, ILGPU.IR.Values.PointerCast, ILGPU.IR.Values.CompareValue, ILGPU.IR.Values.MemoryBarrier, ILGPU.IR.Values.ReturnTerminator, ILGPU.IR.Values.GetViewLength, ILGPU.IR.Values.Barrier, ILGPU.IR.Values.LoadElementAddress, ILGPU.IR.Values.GetArrayExtent, ILGPU.IR.Values.GenericAtomic, ILGPU.IR.Values.UnaryArithmeticValue, ILGPU.IR.Values.GridIndexValue, ILGPU.IR.Values.ConvertValue, ILGPU.IR.Values.MethodCall, ILGPU.IR.Values.Alloca, ILGPU.IR.Values.PredicateBarrier, ILGPU.IR.Values.IfPredicate, ILGPU.IR.Values.SubViewValue, ILGPU.IR.Values.IntAsPointerCast, ILGPU.IR.Values.Parameter, ILGPU.IR.Values.DebugOperation, ILGPU.IR.Values.NewView, ILGPU.IR.Values.ArrayValue, ILGPU.IR.Values.NullValue, ILGPU.IR.Values.AcceleratorTypeValue, ILGPU.IR.Values.HandleValue, and ILGPU.IR.Values.UndefinedValue.

Type Constraints
T :IValueVisitor 
bool ILGPU.IR.Value.Equals ( Value  other)

Returns true if the given value is the same value.

Parameters
otherThe other value.
Returns
True, if the given value is the same value.
override bool ILGPU.IR.Value.Equals ( object  obj)

Returns true if the given object is equal to the current value.

Parameters
objThe other object.
Returns
True, if the given object is equal to the current value.
ReadOnlySpan<ValueReference>.Enumerator ILGPU.IR.Value.GetEnumerator ( )

Returns an enumerator to enumerate all child values.

Returns
An enumerator to enumerate all child values.
Use ILGPU.IR.Value.GetFirstUse ( )

Resolves the first use.

Returns
The first use.
Value ILGPU.IR.Value.GetFirstUseNode ( )

Resolves the first use as value.

Returns
The first use as value.
override int ILGPU.IR.Value.GetHashCode ( )

Returns the hash code of this value.

Returns
The hash code of this value.
void ILGPU.IR.Value.InvalidateType ( )
protected

Invalidates the current type and enforces a re-computation of the current type.

void ILGPU.IR.Value.Replace ( Value  other)

Replaces this value with the given value.

Parameters
otherThe other value.

Implements ILGPU.IR.IValue.

Value ILGPU.IR.Value.Resolve ( )

Resolves the actual value with respect to replacement information.

Returns
The actual value.

Implements ILGPU.IR.IValue.

T ILGPU.IR.Value.ResolveAs< T > ( )

Resolves the actual value with respect to replacement information.

Template Parameters
TThe target type.
Returns
The actual value.

Implements ILGPU.IR.IValue.

Type Constraints
T :Value 
T :Resolve() 
T :as 
T :T 
void ILGPU.IR.Value.Seal ( )
protected

Seals this value.

void ILGPU.IR.Value.Seal ( ValueReference  value1)
protected

Seals this value.

Parameters
value1The first child node.
void ILGPU.IR.Value.Seal ( ValueReference  value1,
ValueReference  value2 
)
protected

Seals this value.

Parameters
value1The first child node.
value2The second child node.
void ILGPU.IR.Value.Seal ( ValueReference  value1,
ValueReference  value2,
ValueReference  value3 
)
protected

Seals this value.

Parameters
value1The first child node.
value2The second child node.
value3The third child node.
void ILGPU.IR.Value.Seal ( ref ValueList  valueList)
protected

Seals this value.

Parameters
valueListThe nested child nodes.
virtual string ILGPU.IR.Value.ToArgString ( )
protectedvirtual

Returns the argument string (operation arguments) of this node.

Returns
The argument string.

Reimplemented in ILGPU.IR.Values.SetField, ILGPU.IR.Values.StructureOperationValue, ILGPU.IR.Values.BuilderTerminator, ILGPU.IR.Values.SwitchBranch, ILGPU.IR.Values.SubWarpShuffle, ILGPU.IR.Values.IfBranch, ILGPU.IR.Values.WarpShuffle, ILGPU.IR.Values.BitCast, ILGPU.IR.Values.TernaryArithmeticValue, ILGPU.IR.Values.ViewCast, ILGPU.IR.Values.PhiValue, ILGPU.IR.Values.Store, ILGPU.IR.Values.Broadcast, ILGPU.IR.Values.SetArrayElement, ILGPU.IR.Values.StringValue, ILGPU.IR.Values.UnconditionalBranch, ILGPU.IR.Values.AddressSpaceCast, ILGPU.IR.Values.LoadFieldAddress, ILGPU.IR.Values.SwitchPredicate, ILGPU.IR.Values.BinaryArithmeticValue, ILGPU.IR.Values.Load, ILGPU.IR.Values.AtomicCAS, ILGPU.IR.Values.PrimitiveValue, ILGPU.IR.Values.PointerCast, ILGPU.IR.Values.CompareValue, ILGPU.IR.Values.MemoryBarrier, ILGPU.IR.Values.ReturnTerminator, ILGPU.IR.Values.LoadElementAddress, ILGPU.IR.Values.GenericAtomic, ILGPU.IR.Values.UnaryArithmeticValue, ILGPU.IR.Values.ConvertValue, ILGPU.IR.Values.MethodCall, ILGPU.IR.Values.ArrayOperationValue, ILGPU.IR.Values.ViewPropertyValue, ILGPU.IR.Values.DeviceConstantDimensionValue, ILGPU.IR.Values.Alloca, ILGPU.IR.Values.PredicateBarrier, ILGPU.IR.Values.IfPredicate, ILGPU.IR.Values.SubViewValue, ILGPU.IR.Values.Parameter, ILGPU.IR.Values.DebugOperation, ILGPU.IR.Values.NewView, ILGPU.IR.Values.NullValue, ILGPU.IR.Values.HandleValue, and ILGPU.IR.Values.UndefinedValue.

sealed override string ILGPU.IR.Value.ToString ( )

Returns the string representation of this node.

Returns
The string representation of this node.
void ILGPU.IR.Value.VerifyNotSealed ( )
protected

Verifies that the this value is not sealed.

Member Data Documentation

int ILGPU.IR.Value.AllNumUses => uses.Count

Returns the total number of all associated uses.

BasicValueType ILGPU.IR.Value.BasicValueType
Initial value:
=>
Type != null ? Type.BasicValueType : BasicValueType.None

Returns the associated basic value type.

bool ILGPU.IR.Value.CanBeReplaced
Initial value:
=>
(ValueFlags & ValueFlags.NotReplacable) != ValueFlags.NotReplacable

Returns true if the current value can be replaced.

bool ILGPU.IR.Value.CanHaveUses
Initial value:
=>
(ValueFlags & ValueFlags.NoUses) != ValueFlags.NoUses

Returns true if the current value can have uses.

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

Returns the number of child values.

const ValueFlags ILGPU.IR.Value.DefaultFlags = ValueFlags.None

The default value flags.

bool ILGPU.IR.Value.HasStaticType
Initial value:
=>
(ValueFlags & ValueFlags.StaticType) != ValueFlags.None

Returns true if the current value has a static type.

bool ILGPU.IR.Value.IsReplaced => CanBeReplaced & Replacement != this

Returns true if the current value has been replaced.

bool ILGPU.IR.Value.IsSealed
Initial value:
=>
(ValueFlags & ValueFlags.IsSealed) != ValueFlags.None

Returns true if the current value has been sealed.

Method ILGPU.IR.Value.Method
Initial value:
=>
parent is BasicBlock basicBlock
? basicBlock.Method
: parent as Method

Returns the parent method.

ReadOnlySpan<ValueReference> ILGPU.IR.Value.Nodes => values

Returns all child values.

ValueReference ILGPU.IR.Value.this[int index] => Nodes[index]

Accesses the child value with the given index.

Parameters
indexThe child-value index.
Returns
The resolved child value.
UseCollection ILGPU.IR.Value.Uses => new UseCollection(this, uses)

Returns all current uses (to non-replaced values).

Property Documentation

BasicBlock ILGPU.IR.Value.BasicBlock
getset

Returns the parent basic block.

Value ILGPU.IR.Value.Replacement
get

Returns the replacement of this value (if any).

TypeNode ILGPU.IR.Value.Type
get

Returns the associated type.

ValueFlags ILGPU.IR.Value.ValueFlags
get

Returns the associated value flags.

abstract ValueKind ILGPU.IR.Value.ValueKind
get

Returns the current value kind.


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