ILGPU  0.9.0
ILGPU.IR.Types.TypeNode Class Referenceabstract

Represents a type in the scope of the ILGPU IR. More...

Inheritance diagram for ILGPU.IR.Types.TypeNode:
ILGPU.IR.Node ILGPU.IR.Types.ITypeNode ILGPU.IR.INode ILGPU.IR.INode ILGPU.IR.ILocation ILGPU.IR.IDumpable ILGPU.IR.ILocation ILGPU.IR.IDumpable ILGPU.IR.Types.AddressSpaceType ILGPU.IR.Types.HandleType ILGPU.IR.Types.ObjectType ILGPU.IR.Types.PrimitiveType ILGPU.IR.Types.StringType ILGPU.IR.Types.VoidType ILGPU.IR.Types.PointerType ILGPU.IR.Types.ViewType ILGPU.IR.Types.ArrayType ILGPU.IR.Types.StructureType

Public Member Functions

bool HasFlags (TypeFlags typeFlags)
 Returns true if the given flags are set. More...
 
As< T > (ILocation location)
 Converts the current type to the given type T . More...
 
override string FormatErrorMessage (string message)
 Formats an error message to include the current debug information. More...
 
override int GetHashCode ()
 Returns the hash code of this type node. More...
 
override bool Equals (object obj)
 Returns true if the given object is equal to the current type. More...
 
override string ToString ()
 Returns the string representation of this node. More...
 
- Public Member Functions inherited from ILGPU.IR.Node
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...
 

Static Public Member Functions

static long Align (long offset, int fieldAlignment)
 Computes a properly aligned offset in bytes for the given field size. More...
 
static int Align (int offset, int fieldAlignment)
 Computes a properly aligned offset in bytes for the given field size. More...
 

Public Attributes

Context Context => TypeContext.Context
 Returns the parent ILGPU context. More...
 
bool IsVoidType => this is VoidType
 Returns true if the current type is a VoidType. More...
 
bool IsStringType => this is StringType
 Returns true if the current type is a StringType. More...
 
bool IsPrimitiveType => this is PrimitiveType
 Returns true if the current type is a PrimitiveType. More...
 
bool IsViewOrPointerType => this is AddressSpaceType
 Returns true if the current type is a PointerType or a ViewType. More...
 
bool IsPointerType => this is PointerType
 Returns true if the current type is a PointerType. More...
 
bool IsViewType => this is ViewType
 Returns true if the current type is a ViewType. More...
 
bool IsObjectType => this is ObjectType
 Returns true if the current type is an ObjectType. More...
 
bool IsStructureType => this is StructureType
 Returns true if the current type is a StructureType. More...
 
bool IsArrayType => this is ArrayType
 Returns true if the current type is a ArrayType. More...
 
bool IsRootType
 Returns true if this type is a root object type. More...
 
BasicValueType BasicValueType
 Returns the basic value type. More...
 
bool IsLowered
 Returns true if this type corresponds to its lowered representation. More...
 
Type ManagedType => managedType # GetManagedType()
 The type representation in the managed world. More...
 

Protected Member Functions

 TypeNode (IRTypeContext typeContext)
 Constructs a new type. More...
 
void AddFlags (TypeFlags typeFlags)
 Adds the given flags to the current type. More...
 
abstract Type GetManagedType ()
 Creates a managed type that corresponds to this IR type. 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

IRTypeContext TypeContext [get]
 Returns the parent type context. More...
 
int Size [get, protected set]
 The size of the type in bytes (if the type is in its lowered representation). More...
 
int Alignment [get, protected set]
 The type alignment in bytes (if the type is in its lowered representation). More...
 
TypeFlags Flags [get]
 Returns all type flags. 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.Types.ITypeNode
Type ManagedType [get]
 The type representation in the managed world. More...
 

Detailed Description

Represents a type in the scope of the ILGPU IR.

Constructor & Destructor Documentation

ILGPU.IR.Types.TypeNode.TypeNode ( IRTypeContext  typeContext)
protected

Constructs a new type.

Parameters
typeContextThe parent type context.

Member Function Documentation

void ILGPU.IR.Types.TypeNode.AddFlags ( TypeFlags  typeFlags)
protected

Adds the given flags to the current type.

Parameters
typeFlagsThe flags to add.
static long ILGPU.IR.Types.TypeNode.Align ( long  offset,
int  fieldAlignment 
)
static

Computes a properly aligned offset in bytes for the given field size.

Parameters
offsetThe current.
fieldAlignmentThe field size in bytes.
Returns
The aligned field offset.
static int ILGPU.IR.Types.TypeNode.Align ( int  offset,
int  fieldAlignment 
)
static

Computes a properly aligned offset in bytes for the given field size.

Parameters
offsetThe current.
fieldAlignmentThe field size in bytes.
Returns
The aligned field offset.
T ILGPU.IR.Types.TypeNode.As< T > ( ILocation  location)

Converts the current type to the given type T .

Template Parameters
TThe target type node.
Parameters
locationThe location to use for assertions.
Returns
The converted type.
Type Constraints
T :TypeNode 
override bool ILGPU.IR.Types.TypeNode.Equals ( object  obj)

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

Parameters
objThe other object.
Returns
True, if the given object is equal to the current type.
override string ILGPU.IR.Types.TypeNode.FormatErrorMessage ( string  message)
virtual

Formats an error message to include the current debug information.

Reimplemented from ILGPU.IR.Node.

override int ILGPU.IR.Types.TypeNode.GetHashCode ( )

Returns the hash code of this type node.

Returns
The hash code of this type node.
abstract Type ILGPU.IR.Types.TypeNode.GetManagedType ( )
protectedpure virtual
bool ILGPU.IR.Types.TypeNode.HasFlags ( TypeFlags  typeFlags)

Returns true if the given flags are set.

Parameters
typeFlagsThe flags to test.
Returns
True, if the given flags are set.
override string ILGPU.IR.Types.TypeNode.ToString ( )

Returns the string representation of this node.

Returns
The string representation of this node.

Member Data Documentation

BasicValueType ILGPU.IR.Types.TypeNode.BasicValueType
Initial value:
=>
this is PrimitiveType primitiveType
? primitiveType.BasicValueType

Returns the basic value type.

Context ILGPU.IR.Types.TypeNode.Context => TypeContext.Context

Returns the parent ILGPU context.

bool ILGPU.IR.Types.TypeNode.IsArrayType => this is ArrayType

Returns true if the current type is a ArrayType.

bool ILGPU.IR.Types.TypeNode.IsLowered
Initial value:
=>
Size > 0 && Alignment > 0 &&
!HasFlags(TypeFlags.ArrayDependent | TypeFlags.ViewDependent)

Returns true if this type corresponds to its lowered representation.

Lowered in this scope means that this type does not contains nested arrays and views. In this case the size and alignment information can be used immediately for interop purposes.

bool ILGPU.IR.Types.TypeNode.IsObjectType => this is ObjectType

Returns true if the current type is an ObjectType.

bool ILGPU.IR.Types.TypeNode.IsPointerType => this is PointerType

Returns true if the current type is a PointerType.

bool ILGPU.IR.Types.TypeNode.IsPrimitiveType => this is PrimitiveType

Returns true if the current type is a PrimitiveType.

bool ILGPU.IR.Types.TypeNode.IsRootType
Initial value:
=>
this is StructureType structureType &&
structureType.NumFields < 1

Returns true if this type is a root object type.

bool ILGPU.IR.Types.TypeNode.IsStringType => this is StringType

Returns true if the current type is a StringType.

bool ILGPU.IR.Types.TypeNode.IsStructureType => this is StructureType

Returns true if the current type is a StructureType.

bool ILGPU.IR.Types.TypeNode.IsViewOrPointerType => this is AddressSpaceType

Returns true if the current type is a PointerType or a ViewType.

bool ILGPU.IR.Types.TypeNode.IsViewType => this is ViewType

Returns true if the current type is a ViewType.

bool ILGPU.IR.Types.TypeNode.IsVoidType => this is VoidType

Returns true if the current type is a VoidType.

Type ILGPU.IR.Types.TypeNode.ManagedType => managedType # GetManagedType()

The type representation in the managed world.

Property Documentation

int ILGPU.IR.Types.TypeNode.Alignment
getprotected set

The type alignment in bytes (if the type is in its lowered representation).

TypeFlags ILGPU.IR.Types.TypeNode.Flags
get

Returns all type flags.

int ILGPU.IR.Types.TypeNode.Size
getprotected set

The size of the type in bytes (if the type is in its lowered representation).

IRTypeContext ILGPU.IR.Types.TypeNode.TypeContext
get

Returns the parent type context.


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