OSDN Git Service

* tree.h (TREE_SET_PERMANENT): New macro. Document conditions
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Feb 2000 04:04:06 +0000 (04:04 +0000)
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Feb 2000 04:04:06 +0000 (04:04 +0000)
under which TREE_PERMANENT will be set.
* tree.c (make_node, copy_node, make_tree_vec, tree_cons,
build1): Use TREE_SET_PERMANENT.
* print-tree.c (print_node): Don't report value of
TREE_PERMANENT if ggc_p is true.

* c-common.c (c_get_alias_set): Don't use TREE_PERMANENT to
decide whether to give a type a new alias set.
* objc/objc-act.c (build_objc_string_object): Never copy the string.
* tree.c (make_node): Set DECL_IN_SYSTEM_HEADER irrespective
of value of 'obstack'.

* f/com.c (ffecom_type_permanent_copy_): Delete unused function.
        (finish_decl): Don't change TREE_PERMANENT (DECL_INITIAL (decl)).

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32128 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-common.c
gcc/f/ChangeLog
gcc/f/com.c
gcc/objc/objc-act.c
gcc/print-tree.c
gcc/tree.c
gcc/tree.h

index da14cce..991d4a7 100644 (file)
@@ -1,3 +1,19 @@
+2000-02-23  Zack Weinberg  <zack@wolery.cumb.org>
+
+       * tree.h (TREE_SET_PERMANENT): New macro.  Document conditions
+       under which TREE_PERMANENT will be set.
+       * tree.c (make_node, copy_node, make_tree_vec, tree_cons,
+       build1): Use TREE_SET_PERMANENT.
+       * print-tree.c (print_node): Don't report value of
+       TREE_PERMANENT if ggc_p is true.
+
+       * c-common.c (c_get_alias_set): Don't use TREE_PERMANENT to
+       decide whether to give a type a new alias set.
+       * objc/objc-act.c (build_objc_string_object): Never copy the string.
+       * tree.c (make_node): Set DECL_IN_SYSTEM_HEADER irrespective
+       of value of 'obstack'.
+
+
 2000-02-24  Michael Hayes  <m.hayes@elec.canterbury.ac.nz>
 
        * config/c4x/c4x.c (c4x_process_after_reload): Split all insns.
index 815c8e1..0a7db5c 100644 (file)
@@ -3490,18 +3490,9 @@ c_get_alias_set (t)
     }
 
   if (!TYPE_ALIAS_SET_KNOWN_P (type))
-    {
-      /* Types that are not global ('permanent') are not
-        placed in the type hash table.  Thus, there can be multiple
-        copies of identical types in local scopes.  In the long run,
-        all types should be permanent.  */
-      if (! TREE_PERMANENT (type))
-       TYPE_ALIAS_SET (type) = 0;
-      else
-       /* TYPE is something we haven't seen before.  Put it in a new
-          alias set.  */
-       TYPE_ALIAS_SET (type) = new_alias_set ();
-    }
+    /* TYPE is something we haven't seen before.  Put it in a new
+       alias set.  */
+    TYPE_ALIAS_SET (type) = new_alias_set ();
 
   return TYPE_ALIAS_SET (type);
 }
index f91cbe7..aa023a5 100644 (file)
@@ -1,3 +1,8 @@
+2000-02-23  Zack Weinberg  <zack@wolery.cumb.org>
+
+       * com.c (ffecom_type_permanent_copy_): Delete unused function.
+        (finish_decl): Don't change TREE_PERMANENT (DECL_INITIAL (decl)).
+
 Sat Feb 19 18:43:13 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * com.c (ffecom_sym_transform): Use DECL_SIZE_UNIT.
index b181f8e..14193eb 100644 (file)
@@ -444,9 +444,6 @@ static tree ffecom_type_localvar_ (ffesymbol s,
                                   ffeinfoBasictype bt,
                                   ffeinfoKindtype kt);
 static tree ffecom_type_namelist_ (void);
-#if 0
-static tree ffecom_type_permanent_copy_ (tree t);
-#endif
 static tree ffecom_type_vardesc_ (void);
 static tree ffecom_vardesc_ (ffebld expr);
 static tree ffecom_vardesc_array_ (ffesymbol s);
@@ -9502,41 +9499,6 @@ ffecom_type_namelist_ ()
 
 #endif
 
-/* Make a copy of a type, assuming caller has switched to the permanent
-   obstacks and that the type is for an aggregate (array) initializer.  */
-
-#if FFECOM_targetCURRENT == FFECOM_targetGCC && 0      /* Not used now. */
-static tree
-ffecom_type_permanent_copy_ (tree t)
-{
-  tree domain;
-  tree max;
-
-  assert (TREE_TYPE (t) != NULL_TREE);
-
-  domain = TYPE_DOMAIN (t);
-
-  assert (TREE_CODE (t) == ARRAY_TYPE);
-  assert (TREE_PERMANENT (TREE_TYPE (t)));
-  assert (TREE_PERMANENT (TREE_TYPE (domain)));
-  assert (TREE_PERMANENT (TYPE_MIN_VALUE (domain)));
-
-  max = TYPE_MAX_VALUE (domain);
-  if (!TREE_PERMANENT (max))
-    {
-      assert (TREE_CODE (max) == INTEGER_CST);
-
-      max = build_int_2 (TREE_INT_CST_LOW (max), TREE_INT_CST_HIGH (max));
-      TREE_TYPE (max) = TREE_TYPE (TYPE_MIN_VALUE (domain));
-    }
-
-  return build_array_type (TREE_TYPE (t),
-                          build_range_type (TREE_TYPE (domain),
-                                            TYPE_MIN_VALUE (domain),
-                                            max));
-}
-#endif
-
 /* Build Vardesc type.  */
 
 #if FFECOM_targetCURRENT == FFECOM_targetGCC
@@ -14095,9 +14057,6 @@ finish_decl (tree decl, tree init, bool is_top_level)
                                0);
     }
 
-  /* This test used to include TREE_PERMANENT, however, we have the same
-     problem with initializers at the function level.  Such initializers get
-     saved until the end of the function on the momentary_obstack.  */
   if (!(TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl))
       && temporary
   /* DECL_INITIAL is not defined in PARM_DECLs, since it shares space with
@@ -14121,11 +14080,6 @@ finish_decl (tree decl, tree init, bool is_top_level)
          if (TREE_READONLY (decl))
            {
              preserve_initializer ();
-             /* Hack?  Set the permanent bit for something that is
-                permanent, but not on the permenent obstack, so as to
-                convince output_constant_def to make its rtl on the
-                permanent obstack.  */
-             TREE_PERMANENT (DECL_INITIAL (decl)) = 1;
 
              /* The initializer and DECL must have the same (or equivalent
                 types), but if the initializer is a STRING_CST, its type
index 87ccf78..2394400 100644 (file)
@@ -1354,13 +1354,6 @@ build_objc_string_object (strings)
   TREE_SET_CODE (string, STRING_CST);
   length = TREE_STRING_LENGTH (string) - 1;
 
-  if (! flag_next_runtime)
-    {
-      if (! TREE_PERMANENT (strings))
-       string = my_build_string (length + 1,
-                                 TREE_STRING_POINTER (string));
-    }
-
   /* & ((NXConstantString) {0, string, length})  */
 
   initlist = build_tree_list (NULL_TREE, build_int_2 (0, 0));
index 7c82d0a..3bef914 100644 (file)
@@ -301,7 +301,7 @@ print_node (file, prefix, node, indent)
     fputs (" used", file);
   if (TREE_RAISES (node))
     fputs (" raises", file);
-  if (TREE_PERMANENT (node))
+  if (!ggc_p && TREE_PERMANENT (node))
     fputs (" permanent", file);
   if (TREE_PUBLIC (node))
     fputs (" public", file);
index 4c5a7ef..3a3f270 100644 (file)
@@ -892,6 +892,8 @@ init_tree_codes ()
 
 /* Return a newly allocated node of code CODE.
    Initialize the node's unique id and its TREE_PERMANENT flag.
+   Note that if garbage collection is in use, TREE_PERMANENT will
+   always be zero - we want to eliminate use of TREE_PERMANENT.
    For decl and type nodes, some other fields are initialized.
    The rest of the node is initialized to zero.
 
@@ -1048,8 +1050,7 @@ make_node (code)
 #endif
 
   TREE_SET_CODE (t, code);
-  if (obstack == &permanent_obstack)
-    TREE_PERMANENT (t) = 1;
+  TREE_SET_PERMANENT (t);
 
   switch (type)
     {
@@ -1061,8 +1062,7 @@ make_node (code)
     case 'd':
       if (code != FUNCTION_DECL)
        DECL_ALIGN (t) = 1;
-      DECL_IN_SYSTEM_HEADER (t)
-       = in_system_header && (obstack == &permanent_obstack);
+      DECL_IN_SYSTEM_HEADER (t) = in_system_header;
       DECL_SOURCE_LINE (t) = lineno;
       DECL_SOURCE_FILE (t) = 
        (input_filename) ? input_filename : built_in_filename;
@@ -1215,7 +1215,7 @@ copy_node (node)
       TYPE_SYMTAB_ADDRESS (t) = 0;
     }
 
-  TREE_PERMANENT (t) = (current_obstack == &permanent_obstack);
+  TREE_SET_PERMANENT (t);
 
   return t;
 }
@@ -1608,8 +1608,7 @@ make_tree_vec (len)
 
   TREE_SET_CODE (t, TREE_VEC);
   TREE_VEC_LENGTH (t) = len;
-  if (obstack == &permanent_obstack)
-    TREE_PERMANENT (t) = 1;
+  TREE_SET_PERMANENT (t);
 
   return t;
 }
@@ -2114,10 +2113,8 @@ tree_cons (purpose, value, chain)
   tree_node_sizes[(int)x_kind] += sizeof (struct tree_list);
 #endif
 
-
   TREE_SET_CODE (node, TREE_LIST);
-  if (current_obstack == &permanent_obstack)
-    TREE_PERMANENT (node) = 1;
+  TREE_SET_PERMANENT (node);
 
   TREE_CHAIN (node) = chain;
   TREE_PURPOSE (node) = purpose;
@@ -3209,9 +3206,7 @@ build1 (code, type, node)
 
   TREE_TYPE (t) = type;
   TREE_SET_CODE (t, code);
-
-  if (obstack == &permanent_obstack)
-    TREE_PERMANENT (t) = 1;
+  TREE_SET_PERMANENT (t);
 
   TREE_OPERAND (t, 0) = node;
   if (node && first_rtl_op (code) != 0)
index a5a6d51..2803514 100644 (file)
@@ -563,8 +563,14 @@ extern void tree_class_check_failed PARAMS ((const tree, char,
 
 /* Nonzero means permanent node;
    node will continue to exist for the entire compiler run.
-   Otherwise it will be recycled at the end of the function.  */
+   Otherwise it will be recycled at the end of the function.
+   This flag is always zero if garbage collection is in use.
+   Try not to use this.  Only set it with TREE_SET_PERMANENT.  */
 #define TREE_PERMANENT(NODE) ((NODE)->common.permanent_flag)
+#define TREE_SET_PERMANENT(NODE) do { \
+  if (!ggc_p && current_obstack == &permanent_obstack) \
+    TREE_PERMANENT(NODE) = 1; \
+} while (0) 
 
 /* In INTEGER_TYPE or ENUMERAL_TYPE nodes, means an unsigned type.
    In FIELD_DECL nodes, means an unsigned bit field.