OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / tree.c
index 34bcb39..155bbf2 100644 (file)
@@ -1,7 +1,7 @@
 /* Language-independent node constructors for parse phase of GNU compiler.
    Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
    1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-   2011 Free Software Foundation, Inc.
+   2011, 2012 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -1617,7 +1617,7 @@ build_zero_cst (tree type)
     {
     case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
     case POINTER_TYPE: case REFERENCE_TYPE:
-    case OFFSET_TYPE:
+    case OFFSET_TYPE: case NULLPTR_TYPE:
       return build_int_cst (type, 0);
 
     case REAL_TYPE:
@@ -2922,6 +2922,7 @@ type_contains_placeholder_1 (const_tree type)
     case METHOD_TYPE:
     case FUNCTION_TYPE:
     case VECTOR_TYPE:
+    case NULLPTR_TYPE:
       return false;
 
     case INTEGER_TYPE:
@@ -4517,11 +4518,17 @@ free_lang_data_in_type (tree type)
   free_lang_data_in_one_sizepos (&TYPE_SIZE (type));
   free_lang_data_in_one_sizepos (&TYPE_SIZE_UNIT (type));
 
-  if (debug_info_level < DINFO_LEVEL_TERSE
-      || (TYPE_CONTEXT (type)
-         && TREE_CODE (TYPE_CONTEXT (type)) != FUNCTION_DECL
-         && TREE_CODE (TYPE_CONTEXT (type)) != NAMESPACE_DECL))
-    TYPE_CONTEXT (type) = NULL_TREE;
+  if (TYPE_CONTEXT (type)
+      && TREE_CODE (TYPE_CONTEXT (type)) == BLOCK)
+    {
+      tree ctx = TYPE_CONTEXT (type);
+      do
+       {
+         ctx = BLOCK_SUPERCONTEXT (ctx);
+       }
+      while (ctx && TREE_CODE (ctx) == BLOCK);
+      TYPE_CONTEXT (type) = ctx;
+    }
 }
 
 
@@ -4596,7 +4603,11 @@ free_lang_data_in_decl (tree decl)
   free_lang_data_in_one_sizepos (&DECL_SIZE (decl));
   free_lang_data_in_one_sizepos (&DECL_SIZE_UNIT (decl));
   if (TREE_CODE (decl) == FIELD_DECL)
-    free_lang_data_in_one_sizepos (&DECL_FIELD_OFFSET (decl));
+    {
+      free_lang_data_in_one_sizepos (&DECL_FIELD_OFFSET (decl));
+      if (TREE_CODE (DECL_CONTEXT (decl)) == QUAL_UNION_TYPE)
+       DECL_QUALIFIER (decl) = NULL_TREE;
+    }
 
  if (TREE_CODE (decl) == FUNCTION_DECL)
     {
@@ -4800,7 +4811,6 @@ find_decls_types_r (tree *tp, int *ws, void *data)
        {
          fld_worklist_push (DECL_FIELD_OFFSET (t), fld);
          fld_worklist_push (DECL_BIT_FIELD_TYPE (t), fld);
-         fld_worklist_push (DECL_QUALIFIER (t), fld);
          fld_worklist_push (DECL_FIELD_BIT_OFFSET (t), fld);
          fld_worklist_push (DECL_FCONTEXT (t), fld);
        }
@@ -4843,7 +4853,15 @@ find_decls_types_r (tree *tp, int *ws, void *data)
       fld_worklist_push (TYPE_MAIN_VARIANT (t), fld);
       /* Do not walk TYPE_NEXT_VARIANT.  We do not stream it and thus
          do not and want not to reach unused variants this way.  */
-      fld_worklist_push (TYPE_CONTEXT (t), fld);
+      if (TYPE_CONTEXT (t))
+       {
+         tree ctx = TYPE_CONTEXT (t);
+         /* We adjust BLOCK TYPE_CONTEXTs to the innermost non-BLOCK one.
+            So push that instead.  */
+         while (ctx && TREE_CODE (ctx) == BLOCK)
+           ctx = BLOCK_SUPERCONTEXT (ctx);
+         fld_worklist_push (ctx, fld);
+       }
       /* Do not walk TYPE_CANONICAL.  We do not stream it and thus do not
         and want not to reach unused types this way.  */
 
@@ -6116,6 +6134,7 @@ type_hash_eq (const void *va, const void *vb)
     case COMPLEX_TYPE:
     case POINTER_TYPE:
     case REFERENCE_TYPE:
+    case NULLPTR_TYPE:
       return 1;
 
     case VECTOR_TYPE:
@@ -8426,11 +8445,19 @@ variably_modified_type_p (tree type, tree fn)
   tree t;
 
 /* Test if T is either variable (if FN is zero) or an expression containing
-   a variable in FN.  */
+   a variable in FN.  If TYPE isn't gimplified, return true also if
+   gimplify_one_sizepos would gimplify the expression into a local
+   variable.  */
 #define RETURN_TRUE_IF_VAR(T)                                          \
   do { tree _t = (T);                                                  \
-    if (_t && _t != error_mark_node && TREE_CODE (_t) != INTEGER_CST   \
-        && (!fn || walk_tree (&_t, find_var_from_fn, fn, NULL)))       \
+    if (_t != NULL_TREE                                                        \
+       && _t != error_mark_node                                        \
+       && TREE_CODE (_t) != INTEGER_CST                                \
+       && TREE_CODE (_t) != PLACEHOLDER_EXPR                           \
+       && (!fn                                                         \
+           || (!TYPE_SIZES_GIMPLIFIED (type)                           \
+               && !is_gimple_sizepos (_t))                             \
+           || walk_tree (&_t, find_var_from_fn, fn, NULL)))            \
       return true;  } while (0)
 
   if (type == error_mark_node)
@@ -9527,6 +9554,10 @@ build_common_builtin_nodes (void)
   local_define_builtin ("__builtin_init_trampoline", ftype,
                        BUILT_IN_INIT_TRAMPOLINE,
                        "__builtin_init_trampoline", ECF_NOTHROW | ECF_LEAF);
+  local_define_builtin ("__builtin_init_heap_trampoline", ftype,
+                       BUILT_IN_INIT_HEAP_TRAMPOLINE,
+                       "__builtin_init_heap_trampoline",
+                       ECF_NOTHROW | ECF_LEAF);
 
   ftype = build_function_type_list (ptr_type_node, ptr_type_node, NULL_TREE);
   local_define_builtin ("__builtin_adjust_trampoline", ftype,