Class ArrayIntrinsics
Supports creating, recognizing and parsing array-related intrinsics.
Inheritance
Inherited Members
Namespace: Flame.Compiler.Instructions
Assembly: Flame.Compiler.dll
Syntax
public static class ArrayIntrinsics
Fields
| Improve this Doc View SourceNamespace
The namespace for array intrinsics.
Declaration
public static readonly IntrinsicNamespace Namespace
Field Value
Type | Description |
---|---|
IntrinsicNamespace |
Methods
| Improve this Doc View SourceCreateGetElementPointerPrototype(IType, IType, IReadOnlyList<IType>)
Creates a 'get_element_pointer' instruction prototype, which indexes an array and produces a reference to the indexed array element.
Declaration
public static IntrinsicPrototype CreateGetElementPointerPrototype(IType elementType, IType arrayType, IReadOnlyList<IType> indexTypes)
Parameters
Type | Name | Description |
---|---|---|
IType | elementType | The type of element to create a reference to. |
IType | arrayType | The type of array to index. |
System.Collections.Generic.IReadOnlyList<IType> | indexTypes | The types of indices to index the array with. |
Returns
Type | Description |
---|---|
IntrinsicPrototype | A 'get_element_pointer' instruction prototype. |
CreateGetLengthPrototype(IType, IType)
Creates a 'get_length' instruction prototype, which computes the number of elements in an array.
Declaration
public static IntrinsicPrototype CreateGetLengthPrototype(IType sizeType, IType arrayType)
Parameters
Type | Name | Description |
---|---|---|
IType | sizeType | The type of integer to store the length of the array in. |
IType | arrayType | The type of array to inspect. |
Returns
Type | Description |
---|---|
IntrinsicPrototype | A 'get_length' instruction prototype. |
CreateLoadElementPrototype(IType, IType, IReadOnlyList<IType>)
Creates a 'load_element' instruction prototype, which indexes an array and loads the indexed array element.
Declaration
public static IntrinsicPrototype CreateLoadElementPrototype(IType elementType, IType arrayType, IReadOnlyList<IType> indexTypes)
Parameters
Type | Name | Description |
---|---|---|
IType | elementType | The type of element to load. |
IType | arrayType | The type of array to index. |
System.Collections.Generic.IReadOnlyList<IType> | indexTypes | The types of indices to index the array with. |
Returns
Type | Description |
---|---|
IntrinsicPrototype | A 'load_element' instruction prototype. |
CreateNewArrayPrototype(IType, IType)
Creates a 'new_array' instruction prototype, allocates a new array.
Declaration
public static IntrinsicPrototype CreateNewArrayPrototype(IType arrayType, IType sizeType)
Parameters
Type | Name | Description |
---|---|---|
IType | arrayType | The type of array to create. |
IType | sizeType | The type of integer that describes the length of the array to create. |
Returns
Type | Description |
---|---|
IntrinsicPrototype | A 'new_array' instruction prototype. |
CreatePrototype(String, IType, IReadOnlyList<IType>)
Creates an array intrinsic prototype.
Declaration
public static IntrinsicPrototype CreatePrototype(string operatorName, IType resultType, IReadOnlyList<IType> parameterTypes)
Parameters
Type | Name | Description |
---|---|---|
System.String | operatorName | The name of the operator represented by the array intrinsic. |
IType | resultType | The type of value produced by the intrinsic to create. |
System.Collections.Generic.IReadOnlyList<IType> | parameterTypes | The types of the values the intrinsic takes as arguments. |
Returns
Type | Description |
---|---|
IntrinsicPrototype | An array intrinsic prototype. |
CreateStoreElementPrototype(IType, IType, IReadOnlyList<IType>)
Creates a 'store_element' instruction prototype, which indexes an array and updates the indexed array element.
Declaration
public static IntrinsicPrototype CreateStoreElementPrototype(IType elementType, IType arrayType, IReadOnlyList<IType> indexTypes)
Parameters
Type | Name | Description |
---|---|---|
IType | elementType | The type of element to store in the array. |
IType | arrayType | The type of array to index. |
System.Collections.Generic.IReadOnlyList<IType> | indexTypes | The types of indices to index the array with. |
Returns
Type | Description |
---|---|
IntrinsicPrototype | A 'store_element' instruction prototype. |