From 24a971750d491c78236d55bdf62492c4125a143d Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Thu, 9 Feb 2012 17:57:26 +0100 Subject: [PATCH] remove Phi0 concept at some places --- include/libfirm/irnode.h | 5 ----- ir/ir/irnode.c | 19 ++++--------------- ir/ir/iropt.c | 10 +++++----- 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/include/libfirm/irnode.h b/include/libfirm/irnode.h index b96dd3986..571d564ed 100644 --- a/include/libfirm/irnode.h +++ b/include/libfirm/irnode.h @@ -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 */ diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 83b3268fe..3285cd08a 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -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); } diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index d9be5c12f..81083a5f5 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -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; } -- 2.20.1