libFirm
|
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 } |
pinned states. More... | |
Functions | |
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 *const in[]) |
Replaces the old in array by a new one that will contain the ins given in the parameters. | |
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. | |
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(get_irn_irg(node)). | |
int | irn_visited (const ir_node *node) |
Returns 1 if visited >= get_irg_visited(get_irn_irg(node)). | |
int | irn_visited_else_mark (ir_node *node) |
Returns 1 if visited >= get_irg_visited(get_irn_irg(node)). | |
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. | |
int | get_irn_pinned (const ir_node *node) |
Returns whether a node is pinned. | |
void | set_irn_pinned (ir_node *node, int pinned) |
Sets pin state for nodes with op pin state op_pin_state_exc_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_node * | exact_copy (const ir_node *node) |
Creates an exact copy of node with same inputs and attributes in the same block. | |
ir_node * | irn_copy_into_irg (const ir_node *node, ir_graph *irg) |
Create an exact copy of node with same inputs and attributes in the same block but stored in the graph irg . | |
ir_node * | get_nodes_block (const ir_node *node) |
Returns the block the node belongs to. | |
void | set_nodes_block (ir_node *node, ir_node *block) |
Sets the Block of a node. | |
const char * | get_builtin_kind_name (ir_builtin_kind kind) |
Returns a human readable string for the ir_builtin_kind. | |
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. | |
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_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. | |
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. | |
int | is_irn_const_memory (const ir_node *node) |
Returns true if the operation does not change anymemory contents although it has a memory input/output. | |
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 (TypeConst, Call, Alloc, Free) or NULL. | |
ir_entity * | get_irn_entity_attr (ir_node *n) |
Returns the entity attribute of a node n (Address, Offset, 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. | |
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 (const void *firm_object) |
Returns a descriptive name of a node (containing type+number) | |
int | is_binop (const ir_node *node) |
Test if node is a binop. | |
int | is_entconst (const ir_node *node) |
Test if node is a entconst. | |
ir_entity * | get_entconst_entity (const ir_node *node) |
Returns entity attribute of an entconst node. | |
void | set_entconst_entity (ir_node *node, ir_entity *entity) |
Sets entity attribute of an entconst node. | |
int | is_typeconst (const ir_node *node) |
Test if node is a typeconst. | |
ir_type * | get_typeconst_type (const ir_node *node) |
Returns type attribute of a typeconst node. | |
void | set_typeconst_type (ir_node *node, ir_type *type) |
Sets type attribute of a typeconst node. | |
ir_node - a datatype representing a Firm node
The common fields are:
Procedure Graph Node.
Definition at line 53 of file firm_types.h.
enum ir_cons_flags |
constrained flags for memory operations.
Definition at line 186 of file firm_types.h.
enum ir_relation |
Relations for comparing numbers.
Definition at line 162 of file firm_types.h.
enum op_pin_state |
pinned states.
Definition at line 201 of file firm_types.h.
Appends a new predecessor to a node.
This only works for nodes with dynamic 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 temporary or calculated information like visited flags or results of dominance or loop calculations.
Creates an exact copy of node
with same inputs and attributes in the same block.
The copied node will not be optimized (so no CSE is performed).
node | the node to copy |
const char * gdb_node_helper | ( | const 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.
Returns entity attribute of an entconst node.
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 the entity attribute of a node n (Address, Offset, 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.
int get_irn_pinned | ( | const ir_node * | node | ) |
Returns whether a node is pinned.
A pinned node must not be moved to a different block even if the operands would allow this. Returns 1 if node is pinned, 0 otherwise.
Returns the type attribute of a node n (TypeConst, Call, Alloc, Free) 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.
"<" --> ">="
Returns the block the node belongs to.
This is only possible for pinned nodes or if the graph is in pinned state. Otherwise the block may be incorrect. This condition is now checked by an assertion.
This works for all except Block. It can return Blocks or the Bad node.
To express the difference to access routines that work for all nodes we use infix "nodes" and do not name this function get_irn_block().
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.
Create an exact copy of node
with same inputs and attributes in the same block but stored in the graph irg
.
The copied node will still point to inputs and a block in the graph of the original node. You must fix up these pointers after copying the node.
node | the node to copy |
irg | the graph in which to store the copied node |
int irn_visited | ( | const ir_node * | node | ) |
Returns 1 if visited >= get_irg_visited(get_irn_irg(node)).
int irn_visited_else_mark | ( | ir_node * | node | ) |
Returns 1 if visited >= get_irg_visited(get_irn_irg(node)).
Marks the node visited, if it was not.
int is_binop | ( | const ir_node * | node | ) |
Test if node is a binop.
int is_cfop | ( | const ir_node * | node | ) |
Returns true if the operation manipulates control flow.
int is_entconst | ( | const ir_node * | node | ) |
Test if node is a entconst.
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.
int is_irn_const_memory | ( | const ir_node * | node | ) |
Returns true if the operation does not change anymemory contents although it has a memory input/output.
int is_irn_constlike | ( | const ir_node * | node | ) |
Returns non-zero for constant-like nodes.
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.
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_typeconst | ( | const ir_node * | node | ) |
Test if node is a typeconst.
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_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(get_irn_irg(node)).
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. Normally you should not use this constructor directly unless you registered custom opcodes. For the default opcodes firm provides specific constructors.
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 entity attribute of an entconst node.
Sets the debug information of a node.
n | The node. |
db | The debug info. |
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. "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, |
int | pinned ) |
Sets pin state for nodes with op pin state op_pin_state_exc_pinned.
pinned
should be 0 or 1,
void set_irn_visited | ( | ir_node * | node, |
ir_visited_t | visited ) |
Sets the visited counter of a node.