diff gcc/ipa-type-escape.c @ 63:b7f97abdc517 gcc-4.6-20100522

update gcc from gcc-4.5.0 to gcc-4.6
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 24 May 2010 12:47:05 +0900
parents 77e2b8dfacca
children f6334be47118
line wrap: on
line diff
--- a/gcc/ipa-type-escape.c	Fri Feb 12 23:41:23 2010 +0900
+++ b/gcc/ipa-type-escape.c	Mon May 24 12:47:05 2010 +0900
@@ -1,6 +1,6 @@
-/* Type based alias analysis.
-   Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
-   Inc.
+/* Escape analysis for types.
+   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010
+   Free Software Foundation, Inc.
    Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
 
 This file is part of GCC.
@@ -53,6 +53,7 @@
 #include "flags.h"
 #include "timevar.h"
 #include "diagnostic.h"
+#include "tree-pretty-print.h"
 #include "langhooks.h"
 
 /* Some of the aliasing is called very early, before this phase is
@@ -1072,7 +1073,7 @@
   tree type = get_canon_type (TREE_TYPE (t), false, false);
   if (!type) return;
 
-  if (lookup_attribute ("used", DECL_ATTRIBUTES (t)))
+  if (DECL_PRESERVE_P (t))
     {
       mark_interesting_type (type, FULL_ESCAPE);
       return;
@@ -1340,7 +1341,8 @@
       if (TYPE_ARG_TYPES (TREE_TYPE (callee_t)))
 	{
 	  for (arg_type = TYPE_ARG_TYPES (TREE_TYPE (callee_t)), i = 0;
-	       arg_type && TREE_VALUE (arg_type) != void_type_node;
+	       arg_type && TREE_VALUE (arg_type) != void_type_node
+	       && i < gimple_call_num_args (call);
 	       arg_type = TREE_CHAIN (arg_type), i++)
 	    {
 	      tree operand = gimple_call_arg (call, i);
@@ -1362,7 +1364,7 @@
 	     have to do this; the front ends should always process
 	     the arg list from the TYPE_ARG_LIST. */
 	  for (arg_type = DECL_ARGUMENTS (callee_t), i = 0;
-	       arg_type;
+	       arg_type && i < gimple_call_num_args (call);
 	       arg_type = TREE_CHAIN (arg_type), i++)
 	    {
 	      tree operand = gimple_call_arg (call, i);
@@ -1984,7 +1986,7 @@
      they may cause a type variable to escape.
   */
   for (node = cgraph_nodes; node; node = node->next)
-    if (node->analyzed)
+    if (node->analyzed && !node->clone_of)
       analyze_function (node);
 
 
@@ -2111,9 +2113,7 @@
 static bool
 gate_type_escape_vars (void)
 {
-  return (flag_ipa_type_escape
-	  /* Don't bother doing anything if the program has errors.  */
-	  && !(errorcount || sorrycount));
+  return flag_ipa_struct_reorg && flag_whole_program && (optimize > 0);
 }
 
 struct simple_ipa_opt_pass pass_ipa_type_escape =