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).
Example (an i386 instruction):
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)
returns the sum of its operands
allocates a block of memory. It can be specified whether the memory should be allocated to the stack or to the heap. Allocates memory for one or more objects (depending on value on count input).
utiliy 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, Bad, ... are found by looking at the respective Anchor operand.
returns the result of a bitwise and operation of its operands
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). Optimisations also set block predecessors to Bad when it becomes clear, that a control flow edge can never be executed.
The gigo optimisations 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 optimisation phase. Block, Phi, Tuple with only Bad inputs however are replaced by Bad right away.
A basic block
Returns the borrow bit from and implied subtractions of its 2 operands
Performs a bounds-check: if lower <= index < upper then return index, otherwise throw an exception.
performs a backend-specific builtin.
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.
Computes the value of the carry-bit that would result when adding the 2 operands
perform a high-level type cast
Compares its two operands and checks whether a specified relation (like less or equal) is fulfilled.
Conditionally change control flow.
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.
Returns a constant value.
Copies a block of memory with statically known size/type.
Internal node which is temporary set to nodes which are already removed from the graph.
returns the quotient of its 2 operands
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.
Last node of a graph. It references nodes in endless loops (so called keepalive edges)
returns the result of a bitwise exclusive or operation of its operands.
This is also known as the Xor operation.
Frees a block of memory previously allocated by an Alloc node
Jumps to the code in its argument. The code has to be in the same function and the the destination must be one of the blocks reachable by the tuple results
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.
Tests whether an object is an instance of a class-type
Loads a value from memory (heap or stack).
returns the remainder of its operands from an implied division.
Examples:
returns the product of its operands
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)
returns the false or true operand depending on the value of the sel operand
Placeholder node for cases where you don't need any memory input
returns the bitwise complement of a value. Works for boolean values, too.
returns the result of a bitwise or operation of its operands
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.
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.
returns an entry of a tuple value
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.
Returns from the current function. Takes memory and return values as operands.
Returns its first operand bits rotated left by the amount in the 2nd operand
Computes the address of a entity of a compound type given the base address of an instance of the compound type.
Optimisations assume that a Sel node can only produce a NULL pointer if the ptr input was NULL.
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.
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.
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.
The first node of a graph. Execution starts with this node.
Stores a value into memory (heap or stack).
returns the difference of its operands
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.
A symbolic constant.
The type of which the constant represents the size is given explicitly.
type. The type of which the constant represents the size is given explicitly.
entity (variable or method). The variable is given explicitly by a firm entity.
entity in its owner type.
an enumeration type.
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.
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.
Returns an unknown (at compile- and runtime) value. It is a valid optimisation to replace an Unknown by any other constant value.