Class DynamicCastPrototype
A prototype for dynamic cast instructions: instructions that convert one pointer type to another but check that this conversion is indeed legal; if it is not, then a null pointer is produced.
Inherited Members
Namespace: Flame.Compiler.Instructions
Assembly: Flame.Compiler.dll
Syntax
public sealed class DynamicCastPrototype : InstructionPrototype
Properties
| Improve this Doc View SourceParameterCount
Gets the number of arguments this instruction takes when instantiated.
Declaration
public override int ParameterCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of arguments this instruction takes. |
Overrides
| Improve this Doc View SourceResultType
Gets the type of value produced instantiations of this prototype.
Declaration
public override IType ResultType { get; }
Property Value
Type | Description |
---|---|
IType | A type of value. |
Overrides
| Improve this Doc View SourceTargetType
Gets the pointer type to cast the input to.
Declaration
public PointerType TargetType { get; }
Property Value
Type | Description |
---|---|
PointerType | The target pointer type. |
Methods
| Improve this Doc View SourceCheckConformance(Instruction, MethodBody)
Checks if a particular instance of this prototype conforms to the rules for this instruction prototype.
Declaration
public override IReadOnlyList<string> CheckConformance(Instruction instance, MethodBody body)
Parameters
Type | Name | Description |
---|---|---|
Instruction | instance | An instance of this prototype. |
MethodBody | body | The method body that defines the instruction. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<System.String> | A list of conformance errors in the instruction. |
Overrides
| Improve this Doc View SourceCreate(PointerType)
Gets or creates a dynamic cast instruction prototype that converts pointers to a specific pointer type.
Declaration
public static DynamicCastPrototype Create(PointerType targetType)
Parameters
Type | Name | Description |
---|---|---|
PointerType | targetType | The target pointer type. |
Returns
Type | Description |
---|---|
DynamicCastPrototype | A dynamic cast instruction prototype. |
GetOperand(Instruction)
Gets the input pointer of an instance of this dynamic cast instruction prototype.
Declaration
public ValueTag GetOperand(Instruction instance)
Parameters
Type | Name | Description |
---|---|---|
Instruction | instance | An instance of this dynamic cast instruction prototype. |
Returns
Type | Description |
---|---|
ValueTag | The input pointer. |
Instantiate(ValueTag)
Creates an instance of this dynamic cast instruction prototype.
Declaration
public Instruction Instantiate(ValueTag operand)
Parameters
Type | Name | Description |
---|---|---|
ValueTag | operand | A pointer to cast to another pointer type. |
Returns
Type | Description |
---|---|
Instruction | A dynamic cast instruction. |
Map(MemberMapping)
Applies a member mapping to this instruction prototype.
Declaration
public override InstructionPrototype Map(MemberMapping mapping)
Parameters
Type | Name | Description |
---|---|---|
MemberMapping | mapping | A member mapping. |
Returns
Type | Description |
---|---|
InstructionPrototype | A transformed instruction prototype. |