IA MCU psABI support: changes to libraries
[gcc.git] / gcc / gimple-expr.c
index c82abb7adab818536394c264d8cc8889858a3dc8..5f05d9361f047ba2117e6b9643b890fb2ebc70f8 100644 (file)
@@ -1,6 +1,6 @@
 /* Gimple decl, type, and expression support functions.
 
-   Copyright (C) 2007-2013 Free Software Foundation, Inc.
+   Copyright (C) 2007-2015 Free Software Foundation, Inc.
    Contributed by Aldy Hernandez <aldyh@redhat.com>
 
 This file is part of GCC.
@@ -23,8 +23,22 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "alias.h"
+#include "symtab.h"
 #include "tree.h"
+#include "fold-const.h"
+#include "predict.h"
+#include "hard-reg-set.h"
+#include "function.h"
+#include "basic-block.h"
+#include "tree-ssa-alias.h"
+#include "internal-fn.h"
+#include "tree-eh.h"
+#include "gimple-expr.h"
+#include "gimple.h"
+#include "stringpool.h"
 #include "gimplify.h"
+#include "stor-layout.h"
 #include "demangle.h"
 #include "gimple-ssa.h"
 
@@ -64,6 +78,12 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
       if (TYPE_ADDR_SPACE (TREE_TYPE (outer_type))
          != TYPE_ADDR_SPACE (TREE_TYPE (inner_type)))
        return false;
+      /* Do not lose casts to function pointer types.  */
+      if ((TREE_CODE (TREE_TYPE (outer_type)) == FUNCTION_TYPE
+          || TREE_CODE (TREE_TYPE (outer_type)) == METHOD_TYPE)
+         && !(TREE_CODE (TREE_TYPE (inner_type)) == FUNCTION_TYPE
+              || TREE_CODE (TREE_TYPE (inner_type)) == METHOD_TYPE))
+       return false;
     }
 
   /* From now on qualifiers on value types do not matter.  */
@@ -122,13 +142,6 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
   else if (POINTER_TYPE_P (inner_type)
           && POINTER_TYPE_P (outer_type))
     {
-      /* Do not lose casts to function pointer types.  */
-      if ((TREE_CODE (TREE_TYPE (outer_type)) == FUNCTION_TYPE
-          || TREE_CODE (TREE_TYPE (outer_type)) == METHOD_TYPE)
-         && !(TREE_CODE (TREE_TYPE (inner_type)) == FUNCTION_TYPE
-              || TREE_CODE (TREE_TYPE (inner_type)) == METHOD_TYPE))
-       return false;
-
       /* We do not care for const qualification of the pointed-to types
         as const qualification has no semantic value to the middle-end.  */
 
@@ -517,6 +530,24 @@ create_tmp_reg (tree type, const char *prefix)
   return tmp;
 }
 
+/* Create a new temporary variable declaration of type TYPE by calling
+   create_tmp_var and if TYPE is a vector or a complex number, mark the new
+   temporary as gimple register.  */
+
+tree
+create_tmp_reg_fn (struct function *fn, tree type, const char *prefix)
+{
+  tree tmp;
+
+  tmp = create_tmp_var_raw (type, prefix);
+  gimple_add_tmp_var_fn (fn, tmp);
+  if (TREE_CODE (type) == COMPLEX_TYPE
+      || TREE_CODE (type) == VECTOR_TYPE)
+    DECL_GIMPLE_REG_P (tmp) = 1;
+
+  return tmp;
+}
+
 
 /* ----- Expression related -----  */
 
@@ -566,7 +597,7 @@ void
 gimple_cond_get_ops_from_tree (tree cond, enum tree_code *code_p,
                                tree *lhs_p, tree *rhs_p)
 {
-  gcc_assert (TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison
+  gcc_assert (COMPARISON_CLASS_P (cond)
              || TREE_CODE (cond) == TRUTH_NOT_EXPR
              || is_gimple_min_invariant (cond)
              || SSA_VAR_P (cond));
@@ -855,10 +886,9 @@ mark_addressable (tree x)
       && cfun->gimple_df != NULL
       && cfun->gimple_df->decls_to_pointers != NULL)
     {
-      void *namep
-       = pointer_map_contains (cfun->gimple_df->decls_to_pointers, x); 
+      tree *namep = cfun->gimple_df->decls_to_pointers->get (x);
       if (namep)
-       TREE_ADDRESSABLE (*(tree *)namep) = 1;
+       TREE_ADDRESSABLE (*namep) = 1;
     }
 }