executes assembler fragments of the target machine.
The node contains a template for an assembler snippet. The compiler will replace occurences of %0 to %9 with input/output registers, %% with a single % char. Some backends allow additional specifiers (for example %w3, %l3, %h3 on x86 to get a 16bit, 8hit low, 8bit high part of a register). After the replacements the text is emitted into the final assembly.
The clobber list contains names of registers which have an undefined value after the assembler instruction is executed; it may also contain memory or cc if global state/memory changes or the condition code registers (some backends implicitely set cc, memory clobbers on all ASM statements).
ASM(text="btsl %1, %0", input_constraints = ["=m", "r"], clobbers = ["cc"])
As there are no output, the %0 references the first input which is just an address which the asm operation writes to. %1 references to an input which is passed as a register. The condition code register has an unknown value after the instruction.
(This format is inspired by the gcc extended asm syntax)
mem memory dependency
… additional inputs (oparity_variable)
ir_asm_constraint* input_constraints input constraints
size_t n_output_constraints number of output constraints
ir_asm_constraint* output_constraints output constraints
size_t n_clobbers number of clobbered registers/memory
ident** clobbers list of clobbered registers/memory
ident* text assembler text
Flags: keep, uses_memory
Symbolic constant that represents the address of an entity (variable or method)
None
ir_entity* entity entity to operate on
Flags: constlike, start_block
A symbolic constant that represents the alignment of a type
None
ir_type* type type to operate on
Flags: constlike, start_block
Allocates a block of memory on the stack.
mem memory dependency
size size of the block in bytes
M memory result
res pointer to newly allocated memory
unsigned alignment alignment of the memory block (must be a power of 2)
Flags: uses_memory, const_memory
Utility node used to "hold" nodes in a graph that might possibly not be reachable by other means or which should be reachable immediately without searching through the graph. Each firm-graph contains exactly one anchor node whose address is always known. All other well-known graph-nodes like Start, End, NoMem, … are found by looking at the respective Anchor operand.
end_block block the end node belongs to
start_block block the start node belongs to
end end node of this ir_graph
start start node of this ir_graph
frame frame of this ir_graph
initial_mem initial memory of this ir_graph
args argument proj of the start node
no_mem the only NoMem node of this ir_graph
Flags: dump_noblock
returns the result of a bitwise and operation of its operands
left first operand
right second operand
Flags: commutative
Bad nodes indicate invalid input, which is values which should never be computed.
The typical use case for the Bad node is removing unreachable code. Frontends should set the current_block to Bad when it is clear that following code must be unreachable (ie. after a goto or return statement). Optimizations also set block predecessors to Bad when it becomes clear, that a control flow edge can never be executed.
The gigo optimizations ensures that nodes with Bad as their block, get replaced by Bad themselves. Nodes with at least 1 Bad input get exchanged with Bad too. Exception to this rule are Block, Phi, Tuple and End node; This is because removing inputs from a Block is hairy operation (requiring, Phis to be shortened too for example). So instead of removing block inputs they are set to Bad, and the actual removal is left to the control flow optimization phase. Block, Phi, Tuple with only Bad inputs however are replaced by Bad right away.
In the future we may use the Bad node to model poison values that arise from undefined behaviour like reading uninitialized local variables in C.
None
Flags: start_block, dump_noblock
Converts a value between modes with different arithmetics but same number of bits by reinterpreting the bits in the new mode
op operand
Flags: None
A basic block
… additional inputs (oparity_variable)
ir_entity* entity entity representing this block
Flags: None
performs a backend-specific builtin.
mem memory dependency
… additional inputs (oparity_variable)
M memory result
ir_builtin_kind kind kind of builtin
ir_type* type method type for the builtin call
Flags: uses_memory
Calls other code. Control flow is transfered to ptr, additional operands are passed to the called code. Called code usually performs a return operation. The operands of this return operation are the result of the Call node.
mem memory dependency
ptr pointer to called code
… additional inputs (oparity_variable)
M memory result
T_result tuple containing all results
X_regular control flow when no exception occurs
X_except control flow when exception occured
ir_type* type type of the call (usually type of the called procedure)
Flags: fragile, uses_memory
Compares its two operands and checks whether a specified relation (like less or equal) is fulfilled.
left first operand
right second operand
ir_relation relation Comparison relation
Flags: None
Specifies constraints for a value. This allows explicit representation of path-sensitive properties. (Example: This value is always >= 0 on 1 if-branch then all users within that branch are rerouted to a confirm-node specifying this property).
A constraint is specified for the relation between value and bound. value is always returned. Note that this node does NOT check or assert the constraint, it merely specifies it.
value value to express a constraint for
bound value to compare against
ir_relation relation relation of value to bound
Flags: None
Returns a constant value.
None
ir_tarval* tarval constant value (a tarval object)
Flags: constlike, start_block
Copies a block of memory with statically known size/type.
mem memory dependency
dst destination address
src source address
ir_type* type type of copied data
ir_volatility volatility volatile CopyB nodes have a visible side-effect and may not be optimized
Flags: uses_memory
Internal node which is temporary set to nodes which are already removed from the graph.
None
Flags: None
returns the quotient of its 2 operands
mem memory dependency
left first operand
right second operand
M memory result
res result of computation
X_regular control flow when no exception occurs
X_except control flow when exception occured
ir_mode* resmode mode of the result value
int no_remainder
Flags: fragile, uses_memory, const_memory
A placeholder value. This is used when constructing cyclic graphs where you have cases where not all predecessors of a phi-node are known. Dummy nodes are used for the unknown predecessors and replaced later.
None
Flags: cfopcode, start_block, constlike, dump_noblock
returns the result of a bitwise exclusive or operation of its operands.
This is also known as the Xor operation.
left first operand
right second operand
Flags: commutative
Frees a block of memory previously allocated by an Alloc node
mem memory dependency
ptr pointer to the object to free
Flags: uses_memory, const_memory
Jumps to the code in its argument. The code has to be in the same function and the destination must be one of the blocks reachable by the tuple results
target target address of the jump
Flags: cfopcode, forking, keep, unknown_jump
Returns its operand unchanged.
This is mainly used when exchanging nodes. Usually you shouldn’t see Id nodes since the getters/setters for node inputs skip them automatically.
pred the value which is returned unchanged
Flags: None
Loads a value from memory (heap or stack).
mem memory dependency
ptr address to load from
M memory result
res result of load operation
X_regular control flow when no exception occurs
X_except control flow when exception occurred
ir_mode* mode mode of the value to be loaded
ir_type* type The type of the object which is stored at ptr (need not match with mode)
ir_volatility volatility volatile loads are a visible side-effect and may not be optimized
ir_align unaligned pointers to unaligned loads don’t need to respect the load-mode/type alignments
Flags: fragile, uses_memory, const_memory
Computes the address of a compound type member given the base address of an instance of the compound type.
A Member node must only produce a NULL pointer if the ptr input is NULL.
ptr pointer to object to select from
ir_entity* entity entity which is selected
Flags: None
returns the remainder of its operands from an implied division.
Examples:
mod(5,3) produces 2
mod(5,-3) produces 2
mod(-5,3) produces -2
mod(-5,-3) produces -2
mem memory dependency
left first operand
right second operand
M memory result
res result of computation
X_regular control flow when no exception occurs
X_except control flow when exception occured
ir_mode* resmode mode of the result
Flags: fragile, uses_memory, const_memory
returns the product of its operands
left first operand
right second operand
Flags: commutative
returns the upper word of the product of its operands (the part which would not fit into the result mode of a normal Mul anymore)
left first operand
right second operand
Flags: commutative
returns the false or true operand depending on the value of the sel operand
sel value making the output selection
false selected if sel input is false
true selected if sel input is true
Flags: None
Placeholder node for cases where you don’t need any memory input
None
Flags: dump_noblock, start_block
returns the bitwise complement of a value. Works for boolean values, too.
op operand
Flags: None
Symbolic constant that represents the offset of an entity in its owner type.
None
ir_entity* entity entity to operate on
Flags: constlike, start_block
returns the result of a bitwise or operation of its operands
left first operand
right second operand
Flags: commutative
Choose a value based on control flow. A phi node has 1 input for each predecessor of its block. If a block is entered from its nth predecessor all phi nodes produce their nth input as result.
… additional inputs (oparity_variable)
int loop wether Phi represents the observable effect of a (possibly) nonterminating loop
Flags: None
Pin the value of the node node in the current block. No users of the Pin node can float above the Block of the Pin. The node cannot float behind this block. Often used to Pin the NoMem node.
op value which is pinned
Flags: None
returns an entry of a tuple value
pred the tuple value from which a part is extracted
unsigned num number of tuple component to be extracted
Flags: None
Raises an exception. Unconditional change of control flow. Writes an explicit Except variable to memory to pass it to the exception handler. Must be lowered to a Call to a runtime check function.
mem memory dependency
exo_ptr pointer to exception object to be thrown
M memory result
X control flow to exception handler
Flags: cfopcode
Computes the address of an array element from the array base pointer and an index.
A Sel node must only produce a NULL pointer if the ptr input is NULL.
ptr pointer to array to select from
index index to select
ir_type* type array type
Flags: None
Returns its first operands bits shifted left by the amount of the 2nd operand. The right input (shift amount) must be an unsigned integer value. If the result mode has modulo_shift!=0, then the effective shift amount is the right input modulo this modulo_shift amount.
left first operand
right second operand
Flags: None
Returns its first operands bits shifted right by the amount of the 2nd operand. No special handling for the sign bit is performed (zero extension). The right input (shift amount) must be an unsigned integer value. If the result mode has modulo_shift!=0, then the effective shift amount is the right input modulo this modulo_shift amount.
left first operand
right second operand
Flags: None
Returns its first operands bits shifted right by the amount of the 2nd operand. The leftmost bit (usually the sign bit) stays the same (sign extension). The right input (shift amount) must be an unsigned integer value. If the result mode has modulo_shift!=0, then the effective shift amount is the right input modulo this modulo_shift amount.
left first operand
right second operand
Flags: None
A symbolic constant that represents the size of a type
None
ir_type* type type to operate on
Flags: constlike, start_block
The first node of a graph. Execution starts with this node.
None
M initial memory
P_frame_base frame base pointer
T_args function arguments
Flags: start_block
Stores a value into memory (heap or stack).
mem memory dependency
ptr address to store to
value value to store
M memory result
X_regular control flow when no exception occurs
X_except control flow when exception occured
ir_type* type The type of the object which is stored at ptr (need not match with value’s type)
ir_volatility volatility volatile stores are a visible side-effect and may not be optimized
ir_align unaligned pointers to unaligned stores don’t need to respect the load-mode/type alignments
Flags: fragile, uses_memory
returns the difference of its operands
left first operand
right second operand
Flags: None
Change control flow. The destination is choosen based on an integer input value which is looked up in a table.
Backends can implement this efficiently using a jump table.
selector input selector
default control flow if no other case matches
unsigned n_outs number of outputs (including pn_Switch_default)
ir_switch_table* table table describing mapping from input values to Proj numbers
The Sync operation unifies several partial memory blocks. These blocks have to be pairwise disjunct or the values in common locations have to be identical. This operation allows to specify all operations that eventually need several partial memory blocks as input with a single entrance by unifying the memories with a preceding Sync operation.
… inputs dynamically mananged (oparity_dynamic)
Flags: None
Builds a Tuple from single values.
This is needed to implement optimizations that remove a node that produced a tuple. The node can be replaced by the Tuple operation so that the following Proj nodes have not to be changed. (They are hard to find due to the implementation with pointers in only one direction.) The Tuple node is smaller than any other node, so that a node can be changed into a Tuple by just changing its opcode and giving it a new in array.
… additional inputs (oparity_variable)
Flags: None
Returns an unknown (at compile- and runtime) value. It is a valid optimization to replace an Unknown by any other constant value.
Be careful when optimising Unknown values, you cannot simply replace Unknown+x or Unknown<x with a new Unknown node if there are multiple users of the original unknown node!
None
Flags: start_block, constlike, dump_noblock