/* Psi support */
ir_node *get_Psi_cond (ir_node *node, int pos) {
- int num_conds = get_irn_arity(node) >> 1;
+ int num_conds = get_Psi_n_conds(node);
assert(node->op == op_Psi);
assert(pos < num_conds);
return node->in[1 + 2 * pos];
}
void set_Psi_cond (ir_node *node, int pos, ir_node *cond) {
- int num_conds = get_irn_arity(node) >> 1;
+ int num_conds = get_Psi_n_conds(node);
assert(node->op == op_Psi);
assert(pos < num_conds);
node->in[1 + 2 * pos] = cond;
}
ir_node *get_Psi_val (ir_node *node, int pos) {
- int num_vals = get_irn_arity(node) >> 1;
+ int num_vals = get_Psi_n_conds(node);
assert(node->op == op_Psi);
assert(pos < num_vals);
return node->in[1 + 2 * pos + 1];
}
void set_Psi_val (ir_node *node, int pos, ir_node *val) {
- int num_vals = get_irn_arity(node) >> 1;
+ int num_vals = get_Psi_n_conds(node);
assert(node->op == op_Psi);
assert(pos < num_vals);
node->in[1 + 2 * pos + 1] = val;
node->in[def_pos] = node;
}
+int (get_Psi_n_conds)(ir_node *node) {
+ return _get_Psi_n_conds(node);
+}
+
/* CopyB support */
ir_node *get_CopyB_mem (ir_node *node) {
assert (node->op == op_CopyB);
void set_Psi_val (ir_node *node, int pos, ir_node *val);
ir_node *get_Psi_default(ir_node *node);
void set_Psi_default(ir_node *node, ir_node *val);
+int get_Psi_n_conds(ir_node *node);
/**
* Projection numbers for result of CopyB node: use for Proj nodes!
node->attr.c.pred = pred;
}
+static INLINE int _get_Psi_n_conds(ir_node *node) {
+ assert(_get_irn_op(node) == op_Psi);
+ return _get_irn_arity(node) >> 1;
+}
+
/* this section MUST contain all inline functions */
#define is_ir_node(thing) _is_ir_node(thing)
#define get_irn_intra_arity(node) _get_irn_intra_arity(node)
#define is_irn_keep(node) _is_irn_keep(node)
#define get_Cond_jmp_pred(node) _get_Cond_jmp_pred(node)
#define set_Cond_jmp_pred(node, pred) _set_Cond_jmp_pred(node, pred)
+#define get_Psi_n_conds(node) _get_Psi_n_conds(node)
# endif /* _IRNODE_T_H_ */