libFirm
|
ir_node - a datatype representing a Firm node More...
Modules | |
Node Opcodes | |
This module specifies the opcodes possible for ir nodes. | |
ASM node | |
executes assembler fragments of the target machine. | |
Add node | |
returns the sum of its operands | |
Alloc node | |
allocates a block of memory. | |
Anchor node | |
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. | |
And node | |
returns the result of a bitwise and operation of its operands | |
Bad node | |
Bad nodes indicate invalid input, which is values which should never be computed. | |
Block node | |
A basic block. | |
Borrow node | |
Returns the borrow bit from and implied subtractions of its 2 operands. | |
Bound node | |
Performs a bounds-check: if lower <= index < upper then return index, otherwise throw an exception. | |
Builtin node | |
performs a backend-specific builtin. | |
Call node | |
Calls other code. | |
Carry node | |
Computes the value of the carry-bit that would result when adding the 2 operands. | |
Cast node | |
perform a high-level type cast | |
Cmp node | |
Compares its two operands and checks whether a specified relation (like less or equal) is fulfilled. | |
Cond node | |
Conditionally change control flow. | |
Confirm node | |
Specifies constraints for a value. | |
Const node | |
Returns a constant value. | |
Conv node | |
Converts values between modes. | |
CopyB node | |
Copies a block of memory with statically known size/type. | |
Deleted node | |
Internal node which is temporary set to nodes which are already removed from the graph. | |
Div node | |
returns the quotient of its 2 operands | |
Dummy node | |
A placeholder value. | |
End node | |
Last node of a graph. | |
Eor node | |
returns the result of a bitwise exclusive or operation of its operands. | |
Free node | |
Frees a block of memory previously allocated by an Alloc node. | |
IJmp node | |
Jumps to the code in its argument. | |
Id node | |
Returns its operand unchanged. | |
InstOf node | |
Tests whether an object is an instance of a class-type. | |
Jmp node | |
Jumps to the block connected through the out-value. | |
Load node | |
Loads a value from memory (heap or stack). | |
Minus node | |
returns the additive inverse of its operand | |
Mod node | |
returns the remainder of its operands from an implied division. | |
Mul node | |
returns the product of its operands | |
Mulh node | |
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) | |
Mux node | |
returns the false or true operand depending on the value of the sel operand | |
NoMem node | |
Placeholder node for cases where you don't need any memory input. | |
Not node | |
returns the bitwise complement of a value. | |
Or node | |
returns the result of a bitwise or operation of its operands | |
Phi node | |
Choose a value based on control flow. | |
Pin node | |
Pin the value of the node node in the current block. | |
Proj node | |
returns an entry of a tuple value | |
Raise node | |
Raises an exception. | |
Return node | |
Returns from the current function. | |
Rotl node | |
Returns its first operand bits rotated left by the amount in the 2nd operand. | |
Sel node | |
Computes the address of a entity of a compound type given the base address of an instance of the compound type. | |
Shl node | |
Returns its first operands bits shifted left by the amount of the 2nd operand. | |
Shr node | |
Returns its first operands bits shifted right by the amount of the 2nd operand. | |
Shrs node | |
Returns its first operands bits shifted right by the amount of the 2nd operand. | |
Start node | |
The first node of a graph. | |
Store node | |
Stores a value into memory (heap or stack). | |
Sub node | |
returns the difference of its operands | |
Switch node | |
Change control flow. | |
SymConst node | |
A symbolic constant. | |
Sync node | |
The Sync operation unifies several partial memory blocks. | |
Tuple node | |
Builds a Tuple from single values. | |
Unknown node | |
Returns an unknown (at compile- and runtime) value. |
Typedefs | |
typedef struct ir_node | ir_node |
Procedure Graph Node. |
Enumerations | |
enum | ir_relation { ir_relation_false = 0, ir_relation_equal = 1u << 0, ir_relation_less = 1u << 1, ir_relation_greater = 1u << 2, ir_relation_unordered = 1u << 3, ir_relation_less_equal = ir_relation_equal|ir_relation_less, ir_relation_greater_equal = ir_relation_equal|ir_relation_greater, ir_relation_less_greater = ir_relation_less|ir_relation_greater, ir_relation_less_equal_greater = ir_relation_equal|ir_relation_less|ir_relation_greater, ir_relation_unordered_equal = ir_relation_unordered|ir_relation_equal, ir_relation_unordered_less = ir_relation_unordered|ir_relation_less, ir_relation_unordered_less_equal = ir_relation_unordered|ir_relation_less|ir_relation_equal, ir_relation_unordered_greater = ir_relation_unordered|ir_relation_greater, ir_relation_unordered_greater_equal = ir_relation_unordered|ir_relation_greater|ir_relation_equal, ir_relation_unordered_less_greater = ir_relation_unordered|ir_relation_less|ir_relation_greater, ir_relation_true = ir_relation_equal|ir_relation_less|ir_relation_greater|ir_relation_unordered } |
Relations for comparing numbers. More... | |
enum | ir_cons_flags { cons_none = 0, cons_volatile = 1U << 0, cons_unaligned = 1U << 1, cons_floats = 1U << 2, cons_throws_exception = 1U << 3 } |
constrained flags for memory operations. More... | |
enum | op_pin_state { op_pin_state_floats = 0, op_pin_state_pinned = 1, op_pin_state_exc_pinned, op_pin_state_mem_pinned } |
pinned states. More... |
Functions | |
int | is_ir_node (const void *thing) |
Checks whether a pointer points to a ir node. | |
int | get_irn_arity (const ir_node *node) |
Returns the number of predecessors without the block predecessor. | |
ir_node * | get_irn_n (const ir_node *node, int n) |
Returns the n-th predecessor of a node. | |
void | set_irn_in (ir_node *node, int arity, ir_node *in[]) |
Replaces the old in array by a new one that will contain the ins given in the parameters. | |
void | add_irn_dep (ir_node *node, ir_node *dep) |
Add an artificial dependency to the node. | |
void | add_irn_deps (ir_node *tgt, ir_node *src) |
Copy all dependencies from a node to another. | |
int | get_irn_deps (const ir_node *node) |
Returns the length of the dependency array. | |
ir_node * | get_irn_dep (const ir_node *node, int pos) |
Returns an entry of the dependency array. | |
void | set_irn_dep (ir_node *node, int pos, ir_node *dep) |
Sets an entry of the dependency array. | |
void | delete_irn_dep (ir_node *node, ir_node *dep) |
Deletes the entry of the dependency array, that points to dep. | |
void | set_irn_n (ir_node *node, int n, ir_node *in) |
Replaces the n-th predecessor of a node with a new one. | |
int | add_irn_n (ir_node *node, ir_node *in) |
Appends a new predecessor to a node. | |
void | set_irn_mode (ir_node *node, ir_mode *mode) |
Sets the mode struct of node. | |
ir_mode * | get_irn_mode (const ir_node *node) |
Returns the mode struct of a node. | |
ir_op * | get_irn_op (const ir_node *node) |
Returns the opcode struct of the node. | |
void | set_irn_op (ir_node *node, ir_op *op) |
Sets the opcode struct of the node. | |
unsigned | get_irn_opcode (const ir_node *node) |
Returns the opcode-enum of the node. | |
const char * | get_irn_opname (const ir_node *node) |
Returns the string representation of the opcode. | |
ident * | get_irn_opident (const ir_node *node) |
Returns the ident for a string representation of the opcode. | |
ir_visited_t | get_irn_visited (const ir_node *node) |
Returns the visited counter of a node. | |
void | set_irn_visited (ir_node *node, ir_visited_t visited) |
Sets the visited counter of a node. | |
void | mark_irn_visited (ir_node *node) |
Sets visited to get_irg_visited(current_ir_graph). | |
int | irn_visited (const ir_node *node) |
Returns 1 if visited >= get_irg_visited(current_ir_graph). | |
int | irn_visited_else_mark (ir_node *node) |
Returns 1 if visited >= get_irg_visited(current_ir_graph). | |
void | set_irn_link (ir_node *node, void *link) |
Sets the link of a node. | |
void * | get_irn_link (const ir_node *node) |
Returns the link of a node. | |
ir_graph * | get_irn_irg (const ir_node *node) |
Returns the ir_graph this node belongs to. | |
long | get_irn_node_nr (const ir_node *node) |
Outputs a unique number for this node if libFIRM is compiled for debugging, (configure with –enable-debug) else returns address of node cast to long. | |
op_pin_state | get_irn_pinned (const ir_node *node) |
Returns the pinned state of a node. | |
void | set_irn_pinned (ir_node *node, op_pin_state state) |
Sets pin state for nodes with op pin state op_pin_state_exc_pinned. | |
op_pin_state | is_irn_pinned_in_irg (const ir_node *node) |
Returns whether the node is currently pinned. | |
ir_node * | new_ir_node (dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mode, int arity, ir_node *const *in) |
IR node constructor. | |
ir_type * | is_frame_pointer (const ir_node *n) |
Tests whether arbitrary node is frame pointer. | |
const char * | get_builtin_kind_name (ir_builtin_kind kind) |
Returns a human readable string for the ir_builtin_kind. | |
int | is_unop (const ir_node *node) |
Tests whether node is an unary operation (opcode arity is oparity_unary) | |
ir_node * | get_unop_op (const ir_node *node) |
Returns (arithmetic) operand of unary operation node . | |
void | set_unop_op (ir_node *node, ir_node *op) |
Sets (arithmetic) operand of unary operation node . | |
int | is_binop (const ir_node *node) |
Tests whether node is a binary operation (opcode arity is oparity_binary) | |
ir_node * | get_binop_left (const ir_node *node) |
Returns left operand of binary operation node . | |
void | set_binop_left (ir_node *node, ir_node *left) |
Sets left operand of binary operation node . | |
ir_node * | get_binop_right (const ir_node *node) |
Returns rights operand of binary operation node . | |
void | set_binop_right (ir_node *node, ir_node *right) |
Sets right operand of binary operation node . | |
int | is_x_except_Proj (const ir_node *node) |
Tests whether a node is the X_except Proj of a fragile operation. | |
int | is_x_regular_Proj (const ir_node *node) |
Tests whether a node is the X_regular Proj of a fragile operation. | |
void | ir_set_throws_exception (ir_node *node, int throws_exception) |
Sets throws exception attribute of a fragile node throws_exception must be 0 or 1. | |
int | ir_throws_exception (const ir_node *node) |
Returns throws_exception attribute of a fragile node. | |
const char * | get_relation_string (ir_relation relation) |
Returns the name of an ir_relation. | |
ir_relation | get_negated_relation (ir_relation relation) |
Calculates the negated (Complement(R)) relation, i.e. | |
ir_relation | get_inversed_relation (ir_relation relation) |
Calculates the inversed (R^-1) relation, i.e., "<" –> ">". | |
int | is_memop (const ir_node *node) |
Returns true if node is a memory operation. | |
ir_node * | get_memop_mem (const ir_node *node) |
Returns the memory input of a memory operation. | |
void | set_memop_mem (ir_node *node, ir_node *mem) |
Sets the memory input of a memory operation. | |
int | is_arg_Proj (const ir_node *node) |
Returns non-zero if a node is a routine parameter. | |
ir_node * | skip_Proj (ir_node *node) |
Returns operand of node if node is a Proj. | |
const ir_node * | skip_Proj_const (const ir_node *node) |
Returns operand of node if node is a Proj. | |
ir_node * | skip_Id (ir_node *node) |
Returns operand of node if node is a Id. | |
ir_node * | skip_Tuple (ir_node *node) |
Returns corresponding operand of Tuple if node is a Proj from a Tuple. | |
ir_node * | skip_Cast (ir_node *node) |
Returns operand of node if node is a Cast. | |
const ir_node * | skip_Cast_const (const ir_node *node) |
Returns operand of node if node is a Cast. | |
ir_node * | skip_Pin (ir_node *node) |
Returns operand of node if node is a Pin. | |
ir_node * | skip_Confirm (ir_node *node) |
Returns operand of node if node is a Confirm. | |
ir_node * | skip_HighLevel_ops (ir_node *node) |
Skip all high-level Operations (including Cast, Confirm). | |
int | is_cfop (const ir_node *node) |
Returns true if the operation manipulates control flow. | |
int | is_unknown_jump (const ir_node *node) |
Returns true if the operation jumps to an unknown destination. | |
int | is_fragile_op (const ir_node *node) |
Returns true if the operation can change the control flow because of an exception: Call, Div, Mod, Load, Store, Alloc, Bad. | |
int | is_irn_forking (const ir_node *node) |
Returns true if the operation is a forking control flow operation: Cond. | |
void | copy_node_attr (ir_graph *irg, const ir_node *old_node, ir_node *new_node) |
Copies attributes stored in the old node to a new node. | |
ir_type * | get_irn_type_attr (ir_node *n) |
Returns the type attribute of a node n (SymConst, Call, Alloc, Free, Cast) or NULL. | |
ir_entity * | get_irn_entity_attr (ir_node *n) |
Returns the entity attribute of a node n (SymConst, Sel) or NULL. | |
int | is_irn_constlike (const ir_node *node) |
Returns non-zero for constant-like nodes. | |
int | is_irn_keep (const ir_node *node) |
Returns non-zero for nodes that are allowed to have keep-alives and are neither Block nor PhiM. | |
int | is_irn_start_block_placed (const ir_node *node) |
Returns non-zero for nodes that are always placed in the start block. | |
int | is_irn_cse_neutral (const ir_node *node) |
Returns non-zero for nodes that are CSE neutral to its users. | |
const char * | get_cond_jmp_predicate_name (cond_jmp_predicate pred) |
Returns the string representation of the jump prediction. | |
void * | get_irn_generic_attr (ir_node *node) |
Returns a pointer to the node attributes. | |
const void * | get_irn_generic_attr_const (const ir_node *node) |
Returns a pointer to the node attributes. | |
unsigned | get_irn_idx (const ir_node *node) |
Returns the unique node index for the node in its graph. | |
void | set_irn_dbg_info (ir_node *n, dbg_info *db) |
Sets the debug information of a node. | |
dbg_info * | get_irn_dbg_info (const ir_node *n) |
Returns the debug information of an node. | |
const char * | gdb_node_helper (void *firm_object) |
Returns a descriptive name of a node (containing type+number) |
ir_node - a datatype representing a Firm node
The common fields are:
Procedure Graph Node.
Definition at line 63 of file firm_types.h.
enum ir_cons_flags |
constrained flags for memory operations.
Definition at line 209 of file firm_types.h.
enum ir_relation |
Relations for comparing numbers.
Definition at line 185 of file firm_types.h.
enum op_pin_state |
pinned states.
Definition at line 224 of file firm_types.h.
Add an artificial dependency to the node.
node | The node. |
dep | The dependency target. |
Copy all dependencies from a node to another.
This is only allowed in phase_backend!
tgt | The node which should be enriched. |
src | The node whose dependencies shall be copied. |
Appends a new predecessor to a node.
This only works for nodes with variable arity!
Copies attributes stored in the old node to a new node.
Assumes both have the same opcode and sufficient size.
irg | The irg of the new_node (get_irn_irg on it might not work yet) |
old_node | the node where the attributes are copied from |
new_node | node the attributes get copies to. |
This copies all essential information to the new node. It does not copy temporal or calculated information like visited flags or results of dominance or loop calculations
Deletes the entry of the dependency array, that points to dep.
Does nothing if no dependency exists.
node | the node to delete the dependency at |
dep | the target of the dependency to delete |
const char* gdb_node_helper | ( | void * | firm_object | ) |
Returns a descriptive name of a node (containing type+number)
const char* get_builtin_kind_name | ( | ir_builtin_kind | kind | ) |
Returns a human readable string for the ir_builtin_kind.
const char* get_cond_jmp_predicate_name | ( | cond_jmp_predicate | pred | ) |
Returns the string representation of the jump prediction.
ir_relation get_inversed_relation | ( | ir_relation | relation | ) |
Calculates the inversed (R^-1) relation, i.e., "<" –> ">".
int get_irn_arity | ( | const ir_node * | node | ) |
Returns the number of predecessors without the block predecessor.
node | the IR-node |
Returns the debug information of an node.
n | The node. |
Returns an entry of the dependency array.
node | The node. |
pos | The position. |
int get_irn_deps | ( | const ir_node * | node | ) |
Returns the length of the dependency array.
node | The node. |
Returns the entity attribute of a node n (SymConst, Sel) or NULL.
void* get_irn_generic_attr | ( | ir_node * | node | ) |
Returns a pointer to the node attributes.
Used for accessing attributes of user-defined nodes.
const void* get_irn_generic_attr_const | ( | const ir_node * | node | ) |
Returns a pointer to the node attributes.
Used for accessing attributes of user-defined nodes.
unsigned get_irn_idx | ( | const ir_node * | node | ) |
Returns the unique node index for the node in its graph.
This index is used to access phase information for this node.
void* get_irn_link | ( | const ir_node * | node | ) |
Returns the link of a node.
Returns the n-th predecessor of a node.
This function removes Id predecessors.
long get_irn_node_nr | ( | const ir_node * | node | ) |
Outputs a unique number for this node if libFIRM is compiled for debugging, (configure with –enable-debug) else returns address of node cast to long.
unsigned get_irn_opcode | ( | const ir_node * | node | ) |
Returns the opcode-enum of the node.
Returns the ident for a string representation of the opcode.
const char* get_irn_opname | ( | const ir_node * | node | ) |
Returns the string representation of the opcode.
op_pin_state get_irn_pinned | ( | const ir_node * | node | ) |
Returns the pinned state of a node.
Returns whether the node always must be pinned. I.e., the node is not floating after global cse.
Returns the type attribute of a node n (SymConst, Call, Alloc, Free, Cast) or NULL.
ir_visited_t get_irn_visited | ( | const ir_node * | node | ) |
Returns the visited counter of a node.
ir_relation get_negated_relation | ( | ir_relation | relation | ) |
Calculates the negated (Complement(R)) relation, i.e.
"<" –> ">="
const char* get_relation_string | ( | ir_relation | relation | ) |
Returns the name of an ir_relation.
void ir_set_throws_exception | ( | ir_node * | node, |
int | throws_exception | ||
) |
Sets throws exception attribute of a fragile node throws_exception
must be 0 or 1.
int ir_throws_exception | ( | const ir_node * | node | ) |
Returns throws_exception attribute of a fragile node.
int irn_visited | ( | const ir_node * | node | ) |
Returns 1 if visited >= get_irg_visited(current_ir_graph).
int irn_visited_else_mark | ( | ir_node * | node | ) |
Returns 1 if visited >= get_irg_visited(current_ir_graph).
Marks the node visited, if it was not.
int is_arg_Proj | ( | const ir_node * | node | ) |
Returns non-zero if a node is a routine parameter.
node | the Proj node to test |
int is_binop | ( | const ir_node * | node | ) |
Tests whether node is a binary operation (opcode arity is oparity_binary)
node
is an binary operation, 0 otherwise int is_cfop | ( | const ir_node * | node | ) |
Returns true if the operation manipulates control flow.
int is_fragile_op | ( | const ir_node * | node | ) |
Returns true if the operation can change the control flow because of an exception: Call, Div, Mod, Load, Store, Alloc, Bad.
Raise is not fragile, but a unconditional jump.
Tests whether arbitrary node is frame pointer.
Tests whether arbitrary node is frame pointer, i.e. Proj(pn_Start_P_frame_base) from Start. If so returns frame type, else Null.
int is_ir_node | ( | const void * | thing | ) |
Checks whether a pointer points to a ir node.
This is guessed by looking at the few bytes of the thing. Most things used in firm have a firm_kind attribute there. This function might falsely return true though for things without a firm_kind at the beginning.
thing | an arbitrary pointer |
int is_irn_constlike | ( | const ir_node * | node | ) |
Returns non-zero for constant-like nodes.
int is_irn_cse_neutral | ( | const ir_node * | node | ) |
Returns non-zero for nodes that are CSE neutral to its users.
int is_irn_forking | ( | const ir_node * | node | ) |
Returns true if the operation is a forking control flow operation: Cond.
int is_irn_keep | ( | const ir_node * | node | ) |
Returns non-zero for nodes that are allowed to have keep-alives and are neither Block nor PhiM.
op_pin_state is_irn_pinned_in_irg | ( | const ir_node * | node | ) |
Returns whether the node is currently pinned.
If get_irn_pinned returns op_pin_state_floats and the graph the node belongs to is in state op_poin_state_floats then this function returns 'floats', else 'pinned'.
int is_irn_start_block_placed | ( | const ir_node * | node | ) |
Returns non-zero for nodes that are always placed in the start block.
int is_memop | ( | const ir_node * | node | ) |
Returns true if node
is a memory operation.
A memory operation is a node with an opcode that has irop_flag_uses_memory set. It is guaranteed to have (exactly) one memory input.
int is_unknown_jump | ( | const ir_node * | node | ) |
Returns true if the operation jumps to an unknown destination.
See irop_flag_unknown_jump for a detailed explanation
int is_unop | ( | const ir_node * | node | ) |
Tests whether node is an unary operation (opcode arity is oparity_unary)
node
is an unary operation, 0 otherwise int is_x_except_Proj | ( | const ir_node * | node | ) |
Tests whether a node is the X_except Proj of a fragile operation.
int is_x_regular_Proj | ( | const ir_node * | node | ) |
Tests whether a node is the X_regular Proj of a fragile operation.
void mark_irn_visited | ( | ir_node * | node | ) |
Sets visited to get_irg_visited(current_ir_graph).
ir_node* new_ir_node | ( | dbg_info * | db, |
ir_graph * | irg, | ||
ir_node * | block, | ||
ir_op * | op, | ||
ir_mode * | mode, | ||
int | arity, | ||
ir_node *const * | in | ||
) |
IR node constructor.
Create a new IR node in irg, with an op, mode, arity and some incoming IR nodes. This constructor is used in every specific IR node constructor.
db | Debug info. |
irg | IR-graph on with this new node should be constructed. |
block | The block the new node belongs to |
op | The opcode of the new node. |
mode | The mode of the new node. |
arity | The arity of the new node, <0 if can be changed dynamically. |
in | An array of arity predecessor nodes. |
Sets right operand of binary operation node
.
Sets the debug information of a node.
n | The node. |
db | The debug info. |
Sets an entry of the dependency array.
node | The node. |
pos | The position. |
dep | The dependency target. |
Replaces the old in array by a new one that will contain the ins given in the parameters.
Conserves the block predecessor. It copies the array passed. This function is necessary to adjust in arrays of blocks, calls and phis. Assumes that current_ir_graph is set to the graph containing "node". "in" must contain all predecessors except the block that are required for the nodes opcode.
void set_irn_link | ( | ir_node * | node, |
void * | link | ||
) |
Sets the link of a node.
Only allowed if the graph is NOT in phase_building.
Replaces the n-th predecessor of a node with a new one.
void set_irn_pinned | ( | ir_node * | node, |
op_pin_state | state | ||
) |
Sets pin state for nodes with op pin state op_pin_state_exc_pinned.
void set_irn_visited | ( | ir_node * | node, |
ir_visited_t | visited | ||
) |
Sets the visited counter of a node.
Sets (arithmetic) operand of unary operation node
.
Skip all high-level Operations (including Cast, Confirm).