Class ArithmeticIntrinsics
Supports creating, recognizing and parsing arithmetic intrinsics.
Inheritance
Inherited Members
Namespace: Flame.Compiler.Instructions
Assembly: Flame.Compiler.dll
Syntax
public static class ArithmeticIntrinsics
Fields
| Improve this Doc View SourceCheckedNamespace
The namespace for checked arithmetic intrinsics.
Declaration
public static readonly IntrinsicNamespace CheckedNamespace
Field Value
| Type | Description |
|---|---|
| IntrinsicNamespace |
UncheckedNamespace
The namespace for unchecked arithmetic intrinsics.
Declaration
public static readonly IntrinsicNamespace UncheckedNamespace
Field Value
| Type | Description |
|---|---|
| IntrinsicNamespace |
Methods
| Improve this Doc View SourceCreatePrototype(String, Boolean, IType, IType[])
Creates an arithmetic intrinsic prototype.
Declaration
public static IntrinsicPrototype CreatePrototype(string operatorName, bool isChecked, IType resultType, params IType[] parameterTypes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | operatorName | The name of the operator represented by the arithmetic intrinsic. |
| System.Boolean | isChecked | Tells if the arithmetic intrinsic is checked, that is, if it throws on overflow. |
| IType | resultType | The type of value produced by the intrinsic to create. |
| IType[] | parameterTypes | The types of the values the intrinsic takes as arguments. |
Returns
| Type | Description |
|---|---|
| IntrinsicPrototype | An arithmetic intrinsic prototype. |
CreatePrototype(String, Boolean, IType, IReadOnlyList<IType>)
Creates an arithmetic intrinsic prototype.
Declaration
public static IntrinsicPrototype CreatePrototype(string operatorName, bool isChecked, IType resultType, IReadOnlyList<IType> parameterTypes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | operatorName | The name of the operator represented by the arithmetic intrinsic. |
| System.Boolean | isChecked | Tells if the arithmetic intrinsic is checked, that is, if it throws on overflow. |
| 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 arithmetic intrinsic prototype. |
GetArithmeticIntrinsicName(String, Boolean)
Creates an arithmetic intrinsic name from an arithmetic operator name.
Declaration
public static string GetArithmeticIntrinsicName(string operatorName, bool isChecked)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | operatorName | The operator name to wrap in an arithmetic intrinsic name. |
| System.Boolean | isChecked | Tells if the arithmetic intrinsic is checked, that is, if it throws on overflow. |
Returns
| Type | Description |
|---|---|
| System.String | An arithmetic intrinsic name. |
IsArithmeticIntrinsicName(String)
Tests if an intrinsic name is an arithmetic intrinsic name.
Declaration
public static bool IsArithmeticIntrinsicName(string intrinsicName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | intrinsicName | The intrinsic name to examine. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
IsArithmeticIntrinsicPrototype(InstructionPrototype)
Tests if an instruction prototype is a intrinsic prototype that corresponds to an arithmetic operation.
Declaration
public static bool IsArithmeticIntrinsicPrototype(InstructionPrototype prototype)
Parameters
| Type | Name | Description |
|---|---|---|
| InstructionPrototype | prototype | The prototype to examine. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
ParseArithmeticIntrinsicName(String)
Parses an intrinsic name as an arithmetic intrinsic name, assuming that the intrinsic name is an arithmetic intrinsic name. Returns the name of the operator wrapped by the arithmetic intrinsic name.
Declaration
public static string ParseArithmeticIntrinsicName(string intrinsicName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | intrinsicName | The arithmetic intrinsic name to parse. |
Returns
| Type | Description |
|---|---|
| System.String | The operator name wrapped by the arithmetic intrinsic name. |
TryEvaluate(IntrinsicPrototype, IReadOnlyList<Constant>, out Constant)
Tries to evaluate an application of a standard arithmetic operator.
Declaration
public static bool TryEvaluate(IntrinsicPrototype prototype, IReadOnlyList<Constant> arguments, out Constant result)
Parameters
| Type | Name | Description |
|---|---|---|
| IntrinsicPrototype | prototype | The full intrinsic prototype for the arithmetic operator. |
| System.Collections.Generic.IReadOnlyList<Constant> | arguments | The operator application's arguments. |
| Constant | result | The operator application's result, if it can be computed. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
TryParseArithmeticIntrinsicName(String, out String, out Boolean)
Tries to parse an intrinsic name as an arithmetic intrinsic name.
Declaration
public static bool TryParseArithmeticIntrinsicName(string intrinsicName, out string operatorName, out bool isChecked)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | intrinsicName | The intrinsic name to parse. |
| System.String | operatorName | The name of the operator specified by the intrinsic, if the intrinsic name is an arithmetic intrinsic name. |
| System.Boolean | isChecked | Tells if the arithmetic intrinsic is checked, that is, if it throws on overflow. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|