IA MCU psABI support: changes to libraries
[gcc.git] / gcc / gimple-ssa-strength-reduction.c
index e719129df24082a12168da201361641fc56edfdc..1d666676c31aa434509e22f3fedf338f9b9d7243 100644 (file)
@@ -1,5 +1,5 @@
 /* Straight-line strength reduction.
-   Copyright (C) 2012-2014 Free Software Foundation, Inc.
+   Copyright (C) 2012-2015 Free Software Foundation, Inc.
    Contributed by Bill Schmidt, IBM <wschmidt@linux.ibm.com>
 
 This file is part of GCC.
@@ -36,17 +36,14 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "alias.h"
+#include "symtab.h"
+#include "options.h"
 #include "tree.h"
-#include "hash-map.h"
-#include "hash-table.h"
+#include "fold-const.h"
 #include "predict.h"
-#include "vec.h"
-#include "hashtab.h"
-#include "hash-set.h"
-#include "machmode.h"
 #include "tm.h"
 #include "hard-reg-set.h"
-#include "input.h"
 #include "function.h"
 #include "dominance.h"
 #include "cfg.h"
@@ -54,11 +51,20 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-ssa-alias.h"
 #include "internal-fn.h"
 #include "gimple-expr.h"
-#include "is-a.h"
 #include "gimple.h"
 #include "gimple-iterator.h"
 #include "gimplify-me.h"
 #include "stor-layout.h"
+#include "rtl.h"
+#include "flags.h"
+#include "insn-config.h"
+#include "expmed.h"
+#include "dojump.h"
+#include "explow.h"
+#include "calls.h"
+#include "emit-rtl.h"
+#include "varasm.h"
+#include "stmt.h"
 #include "expr.h"
 #include "tree-pass.h"
 #include "cfgloop.h"
@@ -70,7 +76,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "stringpool.h"
 #include "tree-ssanames.h"
 #include "domwalk.h"
-#include "expmed.h"
 #include "params.h"
 #include "tree-ssa-address.h"
 #include "tree-affine.h"
@@ -419,23 +424,21 @@ lookup_cand (cand_idx idx)
 
 /* Helper for hashing a candidate chain header.  */
 
-struct cand_chain_hasher : typed_noop_remove <cand_chain>
+struct cand_chain_hasher : nofree_ptr_hash <cand_chain>
 {
-  typedef cand_chain value_type;
-  typedef cand_chain compare_type;
-  static inline hashval_t hash (const value_type *);
-  static inline bool equal (const value_type *, const compare_type *);
+  static inline hashval_t hash (const cand_chain *);
+  static inline bool equal (const cand_chain *, const cand_chain *);
 };
 
 inline hashval_t
-cand_chain_hasher::hash (const value_type *p)
+cand_chain_hasher::hash (const cand_chain *p)
 {
   tree base_expr = p->base_expr;
   return iterative_hash_expr (base_expr, 0);
 }
 
 inline bool
-cand_chain_hasher::equal (const value_type *chain1, const compare_type *chain2)
+cand_chain_hasher::equal (const cand_chain *chain1, const cand_chain *chain2)
 {
   return operand_equal_p (chain1->base_expr, chain2->base_expr, 0);
 }
@@ -1487,8 +1490,8 @@ legal_cast_p_1 (tree lhs, tree rhs)
   rhs_type = TREE_TYPE (rhs);
   lhs_size = TYPE_PRECISION (lhs_type);
   rhs_size = TYPE_PRECISION (rhs_type);
-  lhs_wraps = TYPE_OVERFLOW_WRAPS (lhs_type);
-  rhs_wraps = TYPE_OVERFLOW_WRAPS (rhs_type);
+  lhs_wraps = ANY_INTEGRAL_TYPE_P (lhs_type) && TYPE_OVERFLOW_WRAPS (lhs_type);
+  rhs_wraps = ANY_INTEGRAL_TYPE_P (rhs_type) && TYPE_OVERFLOW_WRAPS (rhs_type);
 
   if (lhs_size < rhs_size
       || (rhs_wraps && !lhs_wraps)
@@ -2186,8 +2189,7 @@ create_add_on_incoming_edge (slsr_cand_t c, tree basis_name,
        }
 
       bump_tree = wide_int_to_tree (basis_type, bump);
-      new_stmt = gimple_build_assign_with_ops (code, lhs, basis_name,
-                                              bump_tree);
+      new_stmt = gimple_build_assign (lhs, code, basis_name, bump_tree);
     }
   else
     {
@@ -2199,15 +2201,14 @@ create_add_on_incoming_edge (slsr_cand_t c, tree basis_name,
       if (incr_vec[i].initializer)
        {
          enum tree_code code = negate_incr ? MINUS_EXPR : PLUS_EXPR;
-         new_stmt = gimple_build_assign_with_ops (code, lhs, basis_name,
-                                                  incr_vec[i].initializer);
+         new_stmt = gimple_build_assign (lhs, code, basis_name,
+                                         incr_vec[i].initializer);
        }
       else if (increment == 1)
-       new_stmt = gimple_build_assign_with_ops (PLUS_EXPR, lhs, basis_name,
-                                                c->stride);
+       new_stmt = gimple_build_assign (lhs, PLUS_EXPR, basis_name, c->stride);
       else if (increment == -1)
-       new_stmt = gimple_build_assign_with_ops (MINUS_EXPR, lhs, basis_name,
-                                                c->stride);
+       new_stmt = gimple_build_assign (lhs, MINUS_EXPR, basis_name,
+                                       c->stride);
       else
        gcc_unreachable ();
     }
@@ -3160,8 +3161,8 @@ insert_initializers (slsr_cand_t c)
       /* Create the initializer and insert it in the latest possible
         dominating position.  */
       incr_tree = wide_int_to_tree (stride_type, incr);
-      init_stmt = gimple_build_assign_with_ops (MULT_EXPR, new_name,
-                                               c->stride, incr_tree);
+      init_stmt = gimple_build_assign (new_name, MULT_EXPR,
+                                      c->stride, incr_tree);
       if (where)
        {
          gimple_stmt_iterator gsi = gsi_for_stmt (where->cand_stmt);
@@ -3264,7 +3265,7 @@ introduce_cast_before_cand (slsr_cand_t c, tree to_type, tree from_expr)
   gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
 
   cast_lhs = make_temp_ssa_name (to_type, NULL, "slsr");
-  cast_stmt = gimple_build_assign_with_ops (NOP_EXPR, cast_lhs, from_expr);
+  cast_stmt = gimple_build_assign (cast_lhs, NOP_EXPR, from_expr);
   gimple_set_location (cast_stmt, gimple_location (c->cand_stmt));
   gsi_insert_before (&gsi, cast_stmt, GSI_SAME_STMT);
 
@@ -3433,8 +3434,7 @@ replace_one_candidate (slsr_cand_t c, unsigned i, tree basis_name)
       else
        {
          gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
-         gassign *cast_stmt = gimple_build_assign_with_ops (NOP_EXPR, lhs,
-                                                            basis_name);
+         gassign *cast_stmt = gimple_build_assign (lhs, NOP_EXPR, basis_name);
          gimple_set_location (cast_stmt, gimple_location (c->cand_stmt));
          gsi_replace (&gsi, cast_stmt, false);
          c->cand_stmt = cast_stmt;