void
set_irn_n (ir_node *node, int n, ir_node *in) {
- assert(node && -1 <= n && n < get_irn_arity(node));
+ assert(node && node->kind == k_ir_node && -1 <= n && n < get_irn_arity(node));
+ assert(in && in->kind == k_ir_node);
if ((n == -1) && (get_irn_opcode(node) == iro_Filter)) {
/* Change block pred in both views! */
node->in[n + 1] = in;
return __get_irn_link(node);
}
+op_pin_state
+(get_irn_pinned)(const ir_node *node) {
+ return __get_irn_pinned(node);
+}
+
#ifdef DO_HEAPANALYSIS
/* Access the abstract interpretation information of a node.
#ifdef DEBUG_libfirm
return node->node_nr;
#else
- return (long)&node;
+ return (long)node;
#endif
}
return node->attr.block;
}
+load_attr
+get_irn_load_attr (ir_node *node)
+{
+ assert (node->op == op_Load);
+ return node->attr.load;
+}
+
+store_attr
+get_irn_store_attr (ir_node *node)
+{
+ assert (node->op == op_Store);
+ return node->attr.store;
+}
+
+except_attr
+get_irn_except_attr (ir_node *node)
+{
+ assert (node->op == op_Div || node->op == op_Quot ||
+ node->op == op_DivMod || node->op == op_Mod);
+ return node->attr.except;
+}
+
/** manipulate fields of individual nodes **/
/* this works for all except Block */
node->attr.block.graph_arr[pos+1] = value;
}
-/* handler handling for Blocks * /
-void
-set_Block_handler (ir_node *block, ir_node *handler) {
- assert ((block->op == op_Block));
- assert ((handler->op == op_Block));
- block->attr.block.handler_entry = handler;
-}
-
-ir_node *
-get_Block_handler (ir_node *block) {
- assert ((block->op == op_Block));
- return (block->attr.block.handler_entry);
-}
-
-/ * handler handling for Nodes * /
-void
-set_Node_handler (ir_node *node, ir_node *handler) {
- set_Block_handler (get_nodes_block (node), handler);
-}
-
-ir_node *
-get_Node_handler (ir_node *node) {
- return (get_Block_handler (get_nodes_block (node)));
-}
-
-/ * exc_t handling for Blocks * /
-void set_Block_exc (ir_node *block, exc_t exc) {
- assert ((block->op == op_Block));
- block->attr.block.exc = exc;
-}
-
-exc_t get_Block_exc (ir_node *block) {
- assert ((block->op == op_Block));
- return (block->attr.block.exc);
-}
-
-/ * exc_t handling for Nodes * /
-void set_Node_exc (ir_node *node, exc_t exc) {
- set_Block_exc (get_nodes_block (node), exc);
-}
-
-exc_t get_Node_exc (ir_node *node) {
- return (get_Block_exc (get_nodes_block (node)));
-}
-*/
-
void set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in) {
assert(node->op == op_Block);
if (node->attr.block.in_cg == NULL || arity != ARR_LEN(node->attr.block.in_cg) - 1) {
}
int Call_has_callees(ir_node *node) {
- return (node->attr.call.callee_arr != NULL);
+ assert(node && node->op == op_Call);
+ return ((get_irg_callee_info_state(get_irn_irg(node)) != irg_callee_info_none) &&
+ (node->attr.call.callee_arr != NULL));
}
int get_Call_n_callees(ir_node * node) {
- assert(node->op == op_Call && node->attr.call.callee_arr);
+ assert(node && node->op == op_Call && node->attr.call.callee_arr);
return ARR_LEN(node->attr.call.callee_arr);
}
entity * get_Call_callee(ir_node * node, int pos) {
- assert(node->op == op_Call && node->attr.call.callee_arr);
+ assert(pos >= 0 && pos < get_Call_n_callees(node));
return node->attr.call.callee_arr[pos];
}
-void set_Call_callee_arr(ir_node * node, int n, entity ** arr) {
+void set_Call_callee_arr(ir_node * node, const int n, entity ** arr) {
assert(node->op == op_Call);
if (node->attr.call.callee_arr == NULL || get_Call_n_callees(node) != n) {
node->attr.call.callee_arr = NEW_ARR_D(entity *, current_ir_graph->obst, n);
}
int FuncCall_has_callees(ir_node *node) {
- return (node->attr.call.callee_arr != NULL);
+ return ((get_irg_callee_info_state(get_irn_irg(node)) != irg_callee_info_none) &&
+ (node->attr.call.callee_arr != NULL));
}
int get_FuncCall_n_callees(ir_node * node) {
set_irn_n(node, pos, pred);
}
+
+int is_memop(ir_node *node) {
+ return ((get_irn_op(node) == op_Load) || (get_irn_op(node) == op_Store));
+}
+
+ir_node *get_memop_mem (ir_node *node) {
+ assert(is_memop(node));
+ return get_irn_n(node, 0);
+}
+
+void set_memop_mem (ir_node *node, ir_node *mem) {
+ assert(is_memop(node));
+ set_irn_n(node, 0, mem);
+}
+
+ir_node *get_memop_ptr (ir_node *node) {
+ assert(is_memop(node));
+ return get_irn_n(node, 1);
+}
+
+void set_memop_ptr (ir_node *node, ir_node *ptr) {
+ assert(is_memop(node));
+ set_irn_n(node, 1, ptr);
+}
+
ir_node *
get_Load_mem (ir_node *node) {
assert (node->op == op_Load);
set_irn_n(node, 1, ptr);
}
+ir_mode *
+get_Load_mode (ir_node *node) {
+ assert (node->op == op_Load);
+ return node->attr.load.load_mode;
+}
+
+void
+set_Load_mode (ir_node *node, ir_mode *mode) {
+ assert (node->op == op_Load);
+ node->attr.load.load_mode = mode;
+}
+
+ent_volatility
+get_Load_volatility (ir_node *node) {
+ assert (node->op == op_Load);
+ return node->attr.load.volatility;
+}
+
+void
+set_Load_volatility (ir_node *node, ent_volatility volatility) {
+ assert (node->op == op_Load);
+ node->attr.load.volatility = volatility;
+}
+
ir_node *
get_Store_mem (ir_node *node) {
set_irn_n(node, 2, value);
}
+ent_volatility
+get_Store_volatility (ir_node *node) {
+ assert (node->op == op_Store);
+ return node->attr.store.volatility;
+}
+
+void
+set_Store_volatility (ir_node *node, ent_volatility volatility) {
+ assert (node->op == op_Store);
+ node->attr.store.volatility = volatility;
+}
+
+
ir_node *
get_Alloc_mem (ir_node *node) {
assert (node->op == op_Alloc);
}
}
+/* Returns true if the operation is a forking control flow operation. */
+int
+is_forking_op(ir_node *node) {
+ return is_op_forking(get_irn_op(node));
+}
+
#ifdef DEBUG_libfirm
void dump_irn (ir_node *n) {
int i, arity = get_irn_arity(n);