char *p;
int i;
- assert(irg && op && mode);
+ assert(irg);
+ assert(op);
+ assert(mode);
p = obstack_alloc(irg->obst, node_size);
memset(p, 0, node_size);
res = (ir_node *)(p + firm_add_node_size);
void set_irn_pinned(ir_node *node, op_pin_state state) {
/* due to optimization an opt may be turned into a Tuple */
- if (get_irn_op(node) == op_Tuple)
+ if (is_Tuple(node))
return;
assert(node && get_op_pinned(get_irn_op(node)) >= op_pin_state_exc_pinned);
_mark_Block_block_visited(node);
}
-int (Block_not_block_visited)(const ir_node *node) {
- return _Block_not_block_visited(node);
-}
-
int (Block_block_visited)(const ir_node *node) {
return _Block_block_visited(node);
}
void add_End_keepalive(ir_node *end, ir_node *ka) {
assert(is_End(end));
- assert((is_Phi(ka) || is_Proj(ka) || is_Block(ka) || is_irn_keep(ka)) && "Only Phi, Block or Keep nodes can be kept alive!");
add_irn_n(end, ka);
}
ir_node **
get_Call_param_arr(ir_node *node) {
assert(is_Call(node));
- return (ir_node **)&get_irn_in(node)[CALL_PARAM_OFFSET + 1];
+ return &get_irn_in(node)[CALL_PARAM_OFFSET + 1];
}
int
BINOP(Add)
+BINOP(Carry)
BINOP(Sub)
UNOP(Minus)
BINOP(Mul)
/* Mux support */
ir_node *get_Mux_sel(const ir_node *node) {
- if (is_Psi(node)) {
- assert(get_irn_arity(node) == 3);
- return get_Psi_cond(node, 0);
- }
assert(is_Mux(node));
return node->in[1];
}
void set_Mux_sel(ir_node *node, ir_node *sel) {
- if (is_Psi(node)) {
- assert(get_irn_arity(node) == 3);
- set_Psi_cond(node, 0, sel);
- } else {
- assert(is_Mux(node));
- node->in[1] = sel;
- }
+ assert(is_Mux(node));
+ node->in[1] = sel;
}
ir_node *get_Mux_false(const ir_node *node) {
- if (is_Psi(node)) {
- assert(get_irn_arity(node) == 3);
- return get_Psi_default(node);
- }
assert(is_Mux(node));
return node->in[2];
}
void set_Mux_false(ir_node *node, ir_node *ir_false) {
- if (is_Psi(node)) {
- assert(get_irn_arity(node) == 3);
- set_Psi_default(node, ir_false);
- } else {
- assert(is_Mux(node));
- node->in[2] = ir_false;
- }
+ assert(is_Mux(node));
+ node->in[2] = ir_false;
}
ir_node *get_Mux_true(const ir_node *node) {
- if (is_Psi(node)) {
- assert(get_irn_arity(node) == 3);
- return get_Psi_val(node, 0);
- }
assert(is_Mux(node));
return node->in[3];
}
void set_Mux_true(ir_node *node, ir_node *ir_true) {
- if (is_Psi(node)) {
- assert(get_irn_arity(node) == 3);
- set_Psi_val(node, 0, ir_true);
- } else {
- assert(is_Mux(node));
- node->in[3] = ir_true;
- }
-}
-
-/* Psi support */
-ir_node *get_Psi_cond(const ir_node *node, int pos) {
- assert(is_Psi(node));
- assert(pos < get_Psi_n_conds(node));
- return get_irn_n(node, 2 * pos);
-}
-
-void set_Psi_cond(ir_node *node, int pos, ir_node *cond) {
- assert(is_Psi(node));
- assert(pos < get_Psi_n_conds(node));
- set_irn_n(node, 2 * pos, cond);
-}
-
-ir_node *get_Psi_val(const ir_node *node, int pos) {
- assert(is_Psi(node));
- assert(pos < get_Psi_n_conds(node));
- return get_irn_n(node, 2 * pos + 1);
-}
-
-void set_Psi_val(ir_node *node, int pos, ir_node *val) {
- assert(is_Psi(node));
- assert(pos < get_Psi_n_conds(node));
- set_irn_n(node, 2 * pos + 1, val);
-}
-
-ir_node *get_Psi_default(const ir_node *node) {
- int def_pos = get_irn_arity(node) - 1;
- assert(is_Psi(node));
- return get_irn_n(node, def_pos);
-}
-
-void set_Psi_default(ir_node *node, ir_node *val) {
- int def_pos = get_irn_arity(node);
- assert(is_Psi(node));
- set_irn_n(node, def_pos, val);
-}
-
-int (get_Psi_n_conds)(const ir_node *node) {
- return _get_Psi_n_conds(node);
+ assert(is_Mux(node));
+ node->in[3] = ir_true;
}
/* CopyB support */
node = get_irn_n(node, -1);
if (is_Bad(node)) /* sometimes bad is predecessor of nodes instead of block: in case of optimization */
node = get_irn_n(node, -1);
- assert(get_irn_op(node) == op_Block);
+ assert(is_Block(node));
return node->attr.block.irg;
}
return node;
}
+/* returns operand of node if node is a Pin */
+ir_node *skip_Pin(ir_node *node) {
+ if (is_Pin(node))
+ return get_Pin_op(node);
+ return node;
+}
+
/* returns operand of node if node is a Confirm */
ir_node *skip_Confirm(ir_node *node) {
- if (get_irn_op(node) == op_Confirm)
+ if (is_Confirm(node))
return get_Confirm_value(node);
return node;
}
return _is_Add(node);
}
+int
+(is_Carry)(const ir_node *node) {
+ return _is_Carry(node);
+}
+
int
(is_And)(const ir_node *node) {
return _is_And(node);
return _is_Not(node);
}
-int
-(is_Psi)(const ir_node *node) {
- return _is_Psi(node);
-}
-
int
(is_Id)(const ir_node *node) {
return _is_Id(node);
return _is_Sel(node);
}
-/* returns true if node is a Mux node or a Psi with only one condition. */
+/* returns true if node is a Mux node. */
int
(is_Mux)(const ir_node *node) {
return _is_Mux(node);