remove Phi0 concept at some places
authorMatthias Braun <matze@braunis.de>
Thu, 9 Feb 2012 16:57:26 +0000 (17:57 +0100)
committerMatthias Braun <matze@braunis.de>
Thu, 9 Feb 2012 17:01:51 +0000 (18:01 +0100)
include/libfirm/irnode.h
ir/ir/irnode.c
ir/ir/iropt.c

index b96dd39..571d564 100644 (file)
@@ -602,11 +602,6 @@ FIRM_API int is_Cast_downcast(ir_node *node);
  * @{
  */
 
-/**
- * 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
  */
index 83b3268..3285cd0 100644 (file)
@@ -379,8 +379,6 @@ unsigned (get_irn_opcode)(const ir_node *node)
 
 const char *get_irn_opname(const ir_node *node)
 {
-       assert(node);
-       if (is_Phi0(node)) return "Phi0";
        return get_id_str(node->op->name);
 }
 
@@ -1107,15 +1105,6 @@ void set_binop_right(ir_node *node, ir_node *right)
        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));
@@ -1124,19 +1113,19 @@ ir_node **get_Phi_preds_arr(ir_node *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);
 }
 
index d9be5c1..81083a5 100644 (file)
@@ -6516,11 +6516,11 @@ static int node_cmp_attr_Sel(const ir_node *a, const ir_node *b)
 /** 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;
 }