* @{
*/
-/**
- * Returns 1 if irg in phase phase_building and the Phi has zero
- * predecessors. It's a "Phi0" then.
- */
-FIRM_API int is_Phi0(const ir_node *n);
/**
* Returns all phi predecessors as array
*/
const char *get_irn_opname(const ir_node *node)
{
- assert(node);
- if (is_Phi0(node)) return "Phi0";
return get_id_str(node->op->name);
}
set_irn_n(node, node->op->op_index + 1, right);
}
-int is_Phi0(const ir_node *n)
-{
- assert(n);
-
- return ((get_irn_op(n) == op_Phi) &&
- (get_irn_arity(n) == 0) &&
- (get_irg_phase_state(get_irn_irg(n)) == phase_building));
-}
-
ir_node **get_Phi_preds_arr(ir_node *node)
{
assert(is_Phi(node));
int get_Phi_n_preds(const ir_node *node)
{
- assert(is_Phi(node) || is_Phi0(node));
- return (get_irn_arity(node));
+ assert(is_Phi(node));
+ return get_irn_arity(node);
}
ir_node *get_Phi_pred(const ir_node *node, int pos)
{
- assert(is_Phi(node) || is_Phi0(node));
+ assert(is_Phi(node));
return get_irn_n(node, pos);
}
void set_Phi_pred(ir_node *node, int pos, ir_node *pred)
{
- assert(is_Phi(node) || is_Phi0(node));
+ assert(is_Phi(node));
set_irn_n(node, pos, pred);
}
/** Compares the attributes of two Phi nodes. */
static int node_cmp_attr_Phi(const ir_node *a, const ir_node *b)
{
- /* we can only enter this function if both nodes have the same number of inputs,
- hence it is enough to check if one of them is a Phi0 */
- if (is_Phi0(a)) {
- /* check the Phi0 pos attribute */
- return a->attr.phi.u.pos != b->attr.phi.u.pos;
+ (void) b;
+ /* do not CSE Phi-nodes without any inputs when building new graphs */
+ if (get_irn_arity(a) == 0 &&
+ get_irg_phase_state(get_irn_irg(a)) == phase_building) {
+ return 1;
}
return 0;
}