Dynamic_Cast_Instruction

class Dynamic_Cast_Instruction (concrete, logical)

Base ⇄ derived cast; works with pointers and references to class types. Uses dynamic_cast semantics:

  • pointer value will be adjusted as needed for multiple inheritance.

  • evaluates to nullptr if object is not an instance of the derived class. (if the output is a reference type, this will be followed by a call to the __axivion_checked_dynamic_cast__ intrinsic, which models the possibility of the std::bad_cast exception)

Direct parents:
Ancestor classes and implemented interfaces:

Conversion_Instruction, Execution_Node, Instruction, Logical_IR_Root, Unary_Instruction

Field

Kind

Type

Description

Original_Type (from Conversion_Instruction)

semantic

class Type

needed as especially when casting fields the source type is not known

Artificial (from Conversion_Instruction)

attribute

builtin Boolean

True for implicit conversions; false for explicit casts.

Right (from Unary_Instruction)

syntactic

interface Reading_Or_Address_Operand_Interface

The input operand of the unary operator.

Left (from Instruction)

syntactic

class Operand

Where the result will be stored. This is always a write operand. (can be NULL, e.g., for calls to void funcs or assertion instructions. Check cafe’s can_omit_lhs() for the full list of instructions that can have Left equal to NoNode.)

Left_Physical (from Instruction)

semantic to physical

class Physical_IR_Root

This edge instead points to the expression that represents the left operand, i.e., the expression that computed the glvalue where the result of the instruction will be stored.

For example, in v = 42; (a LIR Integer_Literal_Instruction):

Its_Type (from Instruction)

semantic

class Type

Result type of the instruction, needed especially to distinguish assignments of complete structs from assignments of their first fields. Also needed to determine multiplication factor for pointer additions. For Cast_Instructions, this is the type casted to

Physical_For_Assignment (from Instruction)

semantic to physical

class Physical_IR_Root

Returns a PIR node for the assignment of the value that was computed by this instruction.

For example, in v = 42; (a LIR Integer_Literal_Instruction):

Parent (from Logical_IR_Root)

semantic

class Logical_IR_Root

Physical (from Logical_IR_Root)

semantic to physical

class Physical_IR_Root