X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gcc%2Ftree-ssa-uncprop.c;h=307bb1fd134047245fa8e9be434e4b8960fb7af9;hb=871b3f473a4bca51d05c1682efb5017385ec9e9e;hp=cf03a54ae54663aaec1b44fd155aaf006477188b;hpb=d6a818c59e002f76f237ad305bf4b73a415dcb3c;p=platform%2Fupstream%2Fgcc.git diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c index cf03a54..307bb1f 100644 --- a/gcc/tree-ssa-uncprop.c +++ b/gcc/tree-ssa-uncprop.c @@ -1,5 +1,5 @@ /* Routines for discovering and unpropagating edge equivalences. - Copyright (C) 2005-2015 Free Software Foundation, Inc. + Copyright (C) 2005-2016 Free Software Foundation, Inc. This file is part of GCC. @@ -20,34 +20,19 @@ along with GCC; see the file COPYING3. If not see #include "config.h" #include "system.h" #include "coretypes.h" -#include "tm.h" -#include "alias.h" -#include "symtab.h" +#include "backend.h" #include "tree.h" +#include "gimple.h" +#include "tree-pass.h" +#include "ssa.h" #include "fold-const.h" -#include "stor-layout.h" -#include "flags.h" -#include "tm_p.h" -#include "predict.h" -#include "hard-reg-set.h" -#include "function.h" -#include "dominance.h" -#include "cfg.h" #include "cfganal.h" -#include "basic-block.h" -#include "tree-ssa-alias.h" -#include "internal-fn.h" -#include "gimple-expr.h" -#include "gimple.h" #include "gimple-iterator.h" -#include "gimple-ssa.h" #include "tree-cfg.h" -#include "tree-phinodes.h" -#include "ssa-iterators.h" #include "domwalk.h" -#include "tree-pass.h" -#include "tree-ssa-propagate.h" #include "tree-hash-traits.h" +#include "tree-ssa-live.h" +#include "tree-ssa-coalesce.h" /* The basic structure describing an equivalency created by traversing an edge. Traversing the edge effectively means that we can assume @@ -75,7 +60,7 @@ associate_equivalences_with_edges (void) FOR_EACH_BB_FN (bb, cfun) { gimple_stmt_iterator gsi = gsi_last_bb (bb); - gimple stmt; + gimple *stmt; /* If the block does not end with a COND_EXPR or SWITCH_EXPR then there is nothing to do. */ @@ -109,23 +94,26 @@ associate_equivalences_with_edges (void) can record an equivalence for OP0 rather than COND. */ if (TREE_CODE (op0) == SSA_NAME && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op0) - && TREE_CODE (TREE_TYPE (op0)) == BOOLEAN_TYPE + && ssa_name_has_boolean_range (op0) && is_gimple_min_invariant (op1)) { + tree true_val = constant_boolean_node (true, TREE_TYPE (op0)); + tree false_val = constant_boolean_node (false, + TREE_TYPE (op0)); if (code == EQ_EXPR) { equivalency = XNEW (struct edge_equivalency); equivalency->lhs = op0; equivalency->rhs = (integer_zerop (op1) - ? boolean_false_node - : boolean_true_node); + ? false_val + : true_val); true_edge->aux = equivalency; equivalency = XNEW (struct edge_equivalency); equivalency->lhs = op0; equivalency->rhs = (integer_zerop (op1) - ? boolean_true_node - : boolean_false_node); + ? true_val + : false_val); false_edge->aux = equivalency; } else @@ -133,15 +121,15 @@ associate_equivalences_with_edges (void) equivalency = XNEW (struct edge_equivalency); equivalency->lhs = op0; equivalency->rhs = (integer_zerop (op1) - ? boolean_true_node - : boolean_false_node); + ? true_val + : false_val); true_edge->aux = equivalency; equivalency = XNEW (struct edge_equivalency); equivalency->lhs = op0; equivalency->rhs = (integer_zerop (op1) - ? boolean_false_node - : boolean_true_node); + ? false_val + : true_val); false_edge->aux = equivalency; } } @@ -158,7 +146,7 @@ associate_equivalences_with_edges (void) this value unless we know that the value is nonzero. */ if (HONOR_SIGNED_ZEROS (op0) && (TREE_CODE (op1) != REAL_CST - || REAL_VALUES_EQUAL (dconst0, TREE_REAL_CST (op1)))) + || real_equal (&dconst0, &TREE_REAL_CST (op1)))) continue; equivalency = XNEW (struct edge_equivalency); @@ -290,26 +278,10 @@ struct equiv_hash_elt vec equivalences; }; -/* Value to ssa name equivalence hashtable helpers. */ - -struct val_ssa_equiv_hash_traits : simple_hashmap_traits -{ - template static inline void remove (T &); -}; - -/* Free an instance of equiv_hash_elt. */ - -template -inline void -val_ssa_equiv_hash_traits::remove (T &elt) -{ - elt.m_value.release (); -} - /* Global hash table implementing a mapping from invariant values to a list of SSA_NAMEs which have the same value. We might be able to reuse tree-vn for this code. */ -static hash_map, val_ssa_equiv_hash_traits> *val_ssa_equiv; +static hash_map > *val_ssa_equiv; static void uncprop_into_successor_phis (basic_block); @@ -334,7 +306,7 @@ class uncprop_dom_walker : public dom_walker public: uncprop_dom_walker (cdi_direction direction) : dom_walker (direction) {} - virtual void before_dom_children (basic_block); + virtual edge before_dom_children (basic_block); virtual void after_dom_children (basic_block); private: @@ -393,7 +365,7 @@ uncprop_into_successor_phis (basic_block bb) /* Walk over the PHI nodes, unpropagating values. */ for (gsi = gsi_start (phis) ; !gsi_end_p (gsi); gsi_next (&gsi)) { - gimple phi = gsi_stmt (gsi); + gimple *phi = gsi_stmt (gsi); tree arg = PHI_ARG_DEF (phi, e->dest_idx); tree res = PHI_RESULT (phi); @@ -464,7 +436,7 @@ single_incoming_edge_ignoring_loop_edges (basic_block bb) return retval; } -void +edge uncprop_dom_walker::before_dom_children (basic_block bb) { basic_block parent; @@ -493,6 +465,7 @@ uncprop_dom_walker::before_dom_children (basic_block bb) m_equiv_stack.safe_push (NULL_TREE); uncprop_into_successor_phis (bb); + return NULL; } namespace { @@ -532,8 +505,7 @@ pass_uncprop::execute (function *fun) associate_equivalences_with_edges (); /* Create our global data structures. */ - val_ssa_equiv - = new hash_map, val_ssa_equiv_hash_traits> (1024); + val_ssa_equiv = new hash_map > (1024); /* We're going to do a dominator walk, so ensure that we have dominance information. */