Divide_Instruction¶
- class Divide_Instruction (concrete, logical)¶
Division. Depending on Its_Type, this might be an integer (also: char/enum), floating-point, fixed-point, C99 imaginary floating-point, or C99 complex floating-point operation. It could also be a vectorized operation of any of the above.
Integer divisions in C truncate towards zero:
5 / 3is1; and-5 / 3is-1. For integer divisions, the behavior is undefined on division by zero or if computingMIN_INT / -1(integer overflow).- Note that mixed types are possible for these operations with C99 imaginary types:
real / imaginary→imaginaryimaginary / real→imaginaryimaginary / imaginary→real
In the
real / imaginarycase, this instruction does more than just a floating point division: it also divides the units (1.0 / Iis-I), therefore negating the underlying result value.For C99 complex types, this instruction performs the whole
complex / complex→complexdivision in a single step.- Direct parents:
inherits Arithmetic_Instruction
- Ancestor classes and implemented interfaces:
Arithmetic_Instruction, Binary_Instruction, Execution_Node, Instruction, Logical_IR_Root
Field
Kind
Type
Description
First (from Binary_Instruction)
syntactic
interface Reading_Or_Address_Operand_Interface
First input operand of the binary instruction.
Second (from Binary_Instruction)
syntactic
interface Reading_Or_Address_Operand_Interface
Second input operand of the binary instruction.
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 toNoNode.)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):The
Physicaledge points to the PIR Integer_Literal.The
Left_Physicaledge points to the Unqualified_Direct_Object_Selection for the variablev.And the
Physical_For_Assignmentedge points to the Assignment expression.
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):The
Physicaledge points to the PIR Integer_Literal.The
Left_Physicaledge points to the Unqualified_Direct_Object_Selection for the variablev.And the
Physical_For_Assignmentedge points to the Assignment expression.
Parent (from Logical_IR_Root)
semantic
class Logical_IR_Root
Physical (from Logical_IR_Root)
semantic to physical
class Physical_IR_Root