libFirm
irnode.h File Reference

Representation of an intermediate operation. More...

#include <stddef.h>
#include "firm_common.h"
#include "typerep.h"
#include "irop.h"
#include "irmode.h"
#include "begin.h"
#include "nodeops.h"
#include "end.h"

Go to the source code of this file.

Macros

#define SYMCONST_HAS_TYPE(kind)   ((kind) <= symconst_type_align)
 Returns non-zero if s symconst kind has a type attribute.
#define SYMCONST_HAS_ENT(kind)   ((kind) == symconst_addr_ent || (kind) == symconst_ofs_ent)
 Returns non-zero if s symconst kind has an entity attribute.
#define SYMCONST_HAS_ENUM(kind)   ((kind) == symconst_enum_const)
 Returns non-zero if s symconst kind has an enum_const attribute.

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_nodeget_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_nodeget_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_modeget_irn_mode (const ir_node *node)
 Returns the mode struct of a node.
ir_opget_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.
identget_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_graphget_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_nodenew_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_nodeget_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.
int get_Block_n_cfgpreds (const ir_node *block)
 Returns the number of control flow predecessors of a block.
ir_nodeget_Block_cfgpred (const ir_node *block, int pos)
 Returns the control flow predecessor of a block at a given position.
void set_Block_cfgpred (ir_node *block, int pos, ir_node *pred)
 Sets the control flow predecessor of a block at a given position.
int get_Block_cfgpred_pos (const ir_node *block, const ir_node *pred)
 Returns the position of the predecessor block pred in the inputs of the block block.
ir_nodeget_Block_cfgpred_block (const ir_node *node, int pos)
 Returns the predecessor block.
int get_Block_matured (const ir_node *block)
 Returns the matured flag of a block.
void set_Block_matured (ir_node *block, int matured)
 set the matured flag of a block.
ir_visited_t get_Block_block_visited (const ir_node *block)
 A visited flag only for block nodes.
void set_Block_block_visited (ir_node *block, ir_visited_t visit)
 set block visited flag
void mark_Block_block_visited (ir_node *node)
 Marks a block as visited by setting its visited counter.
int Block_block_visited (const ir_node *node)
 Returns 1 if a block is marked as visited.
ir_graphget_Block_irg (const ir_node *block)
 Returns the ir_graph this Block belongs to.
ir_entitycreate_Block_entity (ir_node *block)
 Returns the entity for a Block (creating it if necessary)
ir_nodeget_Block_phis (const ir_node *block)
 Returns the head of the Phi list for this block.
void set_Block_phis (ir_node *block, ir_node *phi)
 Sets the head of the Phi list for this block.
void add_Block_phi (ir_node *block, ir_node *phi)
 Add a Phi node to the list of Block Phi's.
unsigned get_Block_mark (const ir_node *block)
 Returns the Block mark (single bit).
void set_Block_mark (ir_node *block, unsigned mark)
 Sets the Block mark (single bit).
ir_typeis_frame_pointer (const ir_node *n)
 Tests whether arbitrary node is frame pointer.
int get_End_n_keepalives (const ir_node *end)
 Returns the number of Keep alive node.
ir_nodeget_End_keepalive (const ir_node *end, int pos)
 Returns the Keep alive node a position pos.
void add_End_keepalive (ir_node *end, ir_node *ka)
 Keep alive dedicated nodes.
void set_End_keepalive (ir_node *end, int pos, ir_node *ka)
 Sets the Keep alive node at position pos.
void set_End_keepalives (ir_node *end, int n, ir_node *in[])
 Sets new keep-alives.
void remove_End_keepalive (ir_node *end, ir_node *irn)
 Removes irn from the keep-alive set.
void remove_End_Bads_and_doublets (ir_node *end)
 Removes Bads, NoMem and doublets from the keep-alive set.
void free_End (ir_node *end)
 Some parts of the End node are allocated separately – their memory is not recovered by dead_node_elimination if a End node is dead.
ir_node ** get_Return_res_arr (ir_node *node)
 Returns return value inputs of Return node node as array.
size_t get_Return_n_ress (const ir_node *node)
 Returns number of return value inputs of Return node node.
ir_nodeget_Return_res (const ir_node *node, int pos)
 Returns return value input pos of Return node node.
void set_Return_res (ir_node *node, int pos, ir_node *res)
 Sets return value input pos of Return node node to value res.
int is_Const_null (const ir_node *node)
 Returns non-zero if the given Const node represents the 0 constant.
int is_Const_one (const ir_node *node)
 Returns non-zero if the given Const node represents the 1 constant.
int is_Const_all_one (const ir_node *node)
 Returns non-zero if the given Const node represents the constant with all bits set.
int is_SymConst_addr_ent (const ir_node *node)
 Returns true if node is a SymConst node with kind symconst_addr_ent.
symconst_kind get_SymConst_kind (const ir_node *node)
 Returns the kind of the SymConst.
void set_SymConst_kind (ir_node *node, symconst_kind num)
 Sets the kind of the SymConst.
ir_typeget_SymConst_type (const ir_node *node)
 Returns the type attribute of SymConst node node.
void set_SymConst_type (ir_node *node, ir_type *tp)
 Sets the type attribute of SymConst node node.
ir_entityget_SymConst_entity (const ir_node *node)
 Returns the entity attribute of SymConst node node.
void set_SymConst_entity (ir_node *node, ir_entity *ent)
 Sets the entity attribute of Symconst node node.
ir_enum_constget_SymConst_enum (const ir_node *node)
 Returns the enum attribute of SymConst node node.
void set_SymConst_enum (ir_node *node, ir_enum_const *ec)
 Sets the enum attribute of SymConst node node.
union symconst_symbol get_SymConst_symbol (const ir_node *node)
 Returns the symbol attribute of SymConst node node.
void set_SymConst_symbol (ir_node *node, union symconst_symbol sym)
 Sets the symbol attribute of SymConst node node.
ir_node ** get_Sel_index_arr (ir_node *node)
 Returns index inputs of Sel node node as array.
int get_Sel_n_indexs (const ir_node *node)
 Returns number of index inputs of Sel node node.
ir_nodeget_Sel_index (const ir_node *node, int pos)
 Returns value of index input pos of Sel node node.
void set_Sel_index (ir_node *node, int pos, ir_node *index)
 Sets index as index input pos of Sel node node.
ir_node ** get_Call_param_arr (ir_node *node)
 Returns parameter inputs of Call node node as array.
int get_Call_n_params (const ir_node *node)
 Returns the number of parameters of a call.
ir_nodeget_Call_param (const ir_node *node, int pos)
 Returns the call parameter at position pos.
void set_Call_param (ir_node *node, int pos, ir_node *param)
 Sets the call parameter at position pos.
int Call_has_callees (const ir_node *node)
 Sets, get and remove the callee information for a Call node.
size_t get_Call_n_callees (const ir_node *node)
 Returns the number of callees of Call node node.
ir_entityget_Call_callee (const ir_node *node, size_t pos)
 Returns callee number pos of Call node node.
void set_Call_callee_arr (ir_node *node, size_t n, ir_entity **arr)
 Sets the full callee array.
void remove_Call_callee_arr (ir_node *node)
 Frees callee array of call node node.
ir_node ** get_Builtin_param_arr (ir_node *node)
 Returns the parameter inputs of Builtin node node as array.
int get_Builtin_n_params (const ir_node *node)
 Returns the number of parameters of a Builtin.
ir_nodeget_Builtin_param (const ir_node *node, int pos)
 Returns the Builtin parameter at position pos.
void set_Builtin_param (ir_node *node, int pos, ir_node *param)
 Sets the Builtin parameter at position pos.
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_nodeget_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_nodeget_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_nodeget_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_Cast_upcast (ir_node *node)
 Checks for upcast.
int is_Cast_downcast (ir_node *node)
 Checks for downcast.
ir_node ** get_Phi_preds_arr (ir_node *node)
 Returns all phi predecessors as array.
int get_Phi_n_preds (const ir_node *node)
 Returns number of predecessors of phi node node.
ir_nodeget_Phi_pred (const ir_node *node, int pos)
 Returns the predecessor with number pos of phi node node.
void set_Phi_pred (ir_node *node, int pos, ir_node *pred)
 Sets value pred as predecessor number pos of phi node node.
ir_nodeget_Phi_next (const ir_node *phi)
 Returns the next element of a block phi list.
void set_Phi_next (ir_node *phi, ir_node *next)
 Sets the next link of a block Phi list.
int is_memop (const ir_node *node)
 Returns true if node is a memory operation.
ir_nodeget_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 ** get_Sync_preds_arr (ir_node *node)
 Returns all predecessors of Sync node node as array.
int get_Sync_n_preds (const ir_node *node)
 Returns number of predecessors of Sync node node.
ir_nodeget_Sync_pred (const ir_node *node, int pos)
 Returns predecessor number pos of Sync node node.
void set_Sync_pred (ir_node *node, int pos, ir_node *pred)
 Sets value pred as predecessor number pos of Sync node node.
void add_Sync_pred (ir_node *node, ir_node *pred)
 Adds pred to predecessor list of Sync node node.
void del_Sync_n (ir_node *n, int i)
 Removes predecessor i from Sync n.
int is_arg_Proj (const ir_node *node)
 Returns non-zero if a node is a routine parameter.
ir_node ** get_Tuple_preds_arr (ir_node *node)
 Returns all predecessors of Tuple node node as array.
int get_Tuple_n_preds (const ir_node *node)
 Returns number of predecessors of Tuple node node.
ir_nodeget_Tuple_pred (const ir_node *node, int pos)
 Returns predecessor number pos of Tuple node node.
void set_Tuple_pred (ir_node *node, int pos, ir_node *pred)
 Sets value pred as predecessor number pos of Tuple node node.
int get_ASM_n_inputs (const ir_node *node)
 Returns the number of input constraints for an ASM node.
ir_nodeget_ASM_input (const ir_node *node, int pos)
 Returns input number pos of an ASM node.
size_t get_ASM_n_output_constraints (const ir_node *node)
 Returns the number of output constraints for an ASM node.
size_t get_ASM_n_clobbers (const ir_node *node)
 Returns the number of clobbered registers for an ASM node.
ir_nodeskip_Proj (ir_node *node)
 Returns operand of node if node is a Proj.
const ir_nodeskip_Proj_const (const ir_node *node)
 Returns operand of node if node is a Proj.
ir_nodeskip_Id (ir_node *node)
 Returns operand of node if node is a Id.
ir_nodeskip_Tuple (ir_node *node)
 Returns corresponding operand of Tuple if node is a Proj from a Tuple.
ir_nodeskip_Cast (ir_node *node)
 Returns operand of node if node is a Cast.
const ir_nodeskip_Cast_const (const ir_node *node)
 Returns operand of node if node is a Cast.
ir_nodeskip_Pin (ir_node *node)
 Returns operand of node if node is a Pin.
ir_nodeskip_Confirm (ir_node *node)
 Returns operand of node if node is a Confirm.
ir_nodeskip_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_typeget_irn_type_attr (ir_node *n)
 Returns the type attribute of a node n (SymConst, Call, Alloc, Free, Cast) or NULL.
ir_entityget_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_infoget_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_switch_tableir_new_switch_table (ir_graph *irg, size_t n_entries)
 Creates a new switch_table datastructure with n_entries entries.
size_t ir_switch_table_get_n_entries (const ir_switch_table *table)
 Returns number of entries available in switch table table.
void ir_switch_table_set (ir_switch_table *table, size_t entry, ir_tarval *min, ir_tarval *max, long pn)
 Sets entry number entry in the switch table table.
ir_tarvalir_switch_table_get_max (const ir_switch_table *table, size_t entry)
 Returns maximum tarval value of switch table entry entry.
ir_tarvalir_switch_table_get_min (const ir_switch_table *table, size_t entry)
 Returns minimum tarval value of switch table entry entry.
long ir_switch_table_get_pn (const ir_switch_table *table, size_t entry)
 Returns proj number taken if switch table entry entry matches.
ir_switch_tableir_switch_table_duplicate (ir_graph *irg, const ir_switch_table *table)
 Duplicates switch table table on obstack of irg.

Detailed Description

Representation of an intermediate operation.

Author
Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck

Definition in file irnode.h.