OSDN Git Service

PR target/47935
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-alias.c
index b5af013..68321d2 100644 (file)
@@ -25,12 +25,12 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm.h"
 #include "tree.h"
 #include "tm_p.h"
+#include "target.h"
 #include "basic-block.h"
 #include "timevar.h"
 #include "ggc.h"
 #include "langhooks.h"
 #include "flags.h"
-#include "toplev.h"
 #include "function.h"
 #include "tree-pretty-print.h"
 #include "tree-dump.h"
@@ -364,7 +364,7 @@ dump_alias_info (FILE *file)
 
   fprintf (file, "Aliased symbols\n\n");
 
-  FOR_EACH_REFERENCED_VAR (var, rvi)
+  FOR_EACH_REFERENCED_VAR (cfun, var, rvi)
     {
       if (may_be_aliased (var))
        dump_variable (file, var);
@@ -808,7 +808,8 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
     return aliasing_component_refs_p (ref1, TREE_TYPE (ptrtype1),
                                      ref1_alias_set, base1_alias_set,
                                      offset1, max_size1,
-                                     ref2, TREE_TYPE (base2),
+                                     ref2, TREE_TYPE
+                                             (reference_alias_ptr_type (ref2)),
                                      ref2_alias_set, base2_alias_set,
                                      offset2, max_size2, true);
 
@@ -1000,21 +1001,23 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
      *D.1663_44 = VIEW_CONVERT_EXPR<struct DB_LSN>(__tmp$B0F64_59);
      which is seen as a struct copy.  */
   if (TREE_CODE (base1) == SSA_NAME
-      || TREE_CODE (base2) == SSA_NAME
       || TREE_CODE (base1) == CONST_DECL
+      || TREE_CODE (base1) == CONSTRUCTOR
+      || TREE_CODE (base1) == ADDR_EXPR
+      || CONSTANT_CLASS_P (base1)
+      || TREE_CODE (base2) == SSA_NAME
       || TREE_CODE (base2) == CONST_DECL
-      || TREE_CODE (base1) == STRING_CST
-      || TREE_CODE (base2) == STRING_CST
-      || is_gimple_min_invariant (base1)
-      || is_gimple_min_invariant (base2))
+      || TREE_CODE (base2) == CONSTRUCTOR
+      || TREE_CODE (base2) == ADDR_EXPR
+      || CONSTANT_CLASS_P (base2))
     return false;
 
   /* We can end up refering to code via function and label decls.
      As we likely do not properly track code aliases conservatively
      bail out.  */
   if (TREE_CODE (base1) == FUNCTION_DECL
-      || TREE_CODE (base2) == FUNCTION_DECL
       || TREE_CODE (base1) == LABEL_DECL
+      || TREE_CODE (base2) == FUNCTION_DECL
       || TREE_CODE (base2) == LABEL_DECL)
     return true;
 
@@ -1416,24 +1419,10 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref)
           being the definition point for the pointer.  */
        case BUILT_IN_MALLOC:
        case BUILT_IN_CALLOC:
-         /* Unix98 specifies that errno is set on allocation failure.
-            Until we properly can track the errno location assume it
-            is not a local decl but external or anonymous storage in
-            a different translation unit.  Also assume it is of
-            type int as required by the standard.  */
+         /* Unix98 specifies that errno is set on allocation failure.  */
          if (flag_errno_math
-             && TREE_TYPE (base) == integer_type_node)
-           {
-             struct ptr_info_def *pi;
-             if (DECL_P (base)
-                 && !TREE_STATIC (base))
-               return true;
-             else if ((INDIRECT_REF_P (base)
-                       || TREE_CODE (base) == MEM_REF)
-                      && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME
-                      && (pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0))))
-               return pi->pt.anything || pi->pt.nonlocal;
-           }
+             && targetm.ref_may_alias_errno (ref))
+           return true;
          return false;
        /* Freeing memory kills the pointed-to memory.  More importantly
           the call has to serve as a barrier for moving loads and stores
@@ -1572,7 +1561,7 @@ stmt_may_clobber_ref_p_1 (gimple stmt, ao_ref *ref)
     {
       tree lhs = gimple_call_lhs (stmt);
       if (lhs
-         && !is_gimple_reg (lhs))
+         && TREE_CODE (lhs) != SSA_NAME)
        {
          ao_ref r;
          ao_ref_init (&r, lhs);
@@ -1585,10 +1574,10 @@ stmt_may_clobber_ref_p_1 (gimple stmt, ao_ref *ref)
   else if (gimple_assign_single_p (stmt))
     {
       tree lhs = gimple_assign_lhs (stmt);
-      if (!is_gimple_reg (lhs))
+      if (TREE_CODE (lhs) != SSA_NAME)
        {
          ao_ref r;
-         ao_ref_init (&r, gimple_assign_lhs (stmt));
+         ao_ref_init (&r, lhs);
          return refs_may_alias_p_1 (ref, &r, true);
        }
     }