OSDN Git Service

* cp-tree.h (copy_to_permanent): Remove.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Sep 1999 20:12:35 +0000 (20:12 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Sep 1999 20:12:35 +0000 (20:12 +0000)
(permanent_p): Likewise.
* decl.c (building_typename_type): Don't use copy_to_permanent.
(start_decl): Likewise.
(grok_reference_init): Likewise.
(cp_finish_decl): Likewise.
* init.c (build_new_1): Don't use mapcar.
(build_vec_delete_1): Don't use copy_to_permanent.
(build_vec_init): Likewise.
* parse.y (primary): Likewise.
* parse.c: Regenerated.
* pt.c (push_template_decl_real): Don't use copy_to_permanent.
(lookup_template_class): Likewise.
(tsubst_friend_function): Likewise.
(instantiate_class_template): Likewise.
(tsubst_decl): Likewise.
(tsubst): Likewise.
(instantiate_template): Likewise.
(unify): Likewise.
* rtti.c (get_tinfo_fn): Likewise.
(build_dynamic_cast): Likewise.
* semantics.c (finish_if_stmt_cond): Likewise.
(finish_while_stmt_cond): Likewise.
(finish_do_stmt): Likewise.
(finish_for_cond): Likewise.
(finish_for_expr): Likewise.
(finish_cleanup): Likewise.
(add_decl_stmt): Likewise.
(finish_named_return_value): Likewise.
(finish_qualified_call_expr): Likewise.
* tree.c (perm_manip): Remove.
(build_exception_variant): Don't use copy_to_permanent.
(permanent_p): Remove.
(copy_to_permament): Remove.
(build_min_nt): Don't use copy_to_permanent.
(build_min): Likewise.
(min_tree_cons): Likewise.
* typeckc.c (build_static_cast): Likewise.
(build_reinterpret_cast): Likewise.
(build_const_cast): Likewise.

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

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/init.c
gcc/cp/parse.c
gcc/cp/parse.y
gcc/cp/pt.c
gcc/cp/rtti.c
gcc/cp/semantics.c
gcc/cp/tree.c
gcc/cp/typeck.c

index 578202a..4b689de 100644 (file)
@@ -1,3 +1,46 @@
+1999-09-08  Mark Mitchell  <mark@codesourcery.com>
+
+       * cp-tree.h (copy_to_permanent): Remove.
+       (permanent_p): Likewise.
+       * decl.c (building_typename_type): Don't use copy_to_permanent.
+       (start_decl): Likewise.
+       (grok_reference_init): Likewise.
+       (cp_finish_decl): Likewise.
+       * init.c (build_new_1): Don't use mapcar.
+       (build_vec_delete_1): Don't use copy_to_permanent.
+       (build_vec_init): Likewise.
+       * parse.y (primary): Likewise.
+       * parse.c: Regenerated.
+       * pt.c (push_template_decl_real): Don't use copy_to_permanent.
+       (lookup_template_class): Likewise.
+       (tsubst_friend_function): Likewise.
+       (instantiate_class_template): Likewise.
+       (tsubst_decl): Likewise.
+       (tsubst): Likewise.
+       (instantiate_template): Likewise.
+       (unify): Likewise.
+       * rtti.c (get_tinfo_fn): Likewise.
+       (build_dynamic_cast): Likewise.
+       * semantics.c (finish_if_stmt_cond): Likewise.
+       (finish_while_stmt_cond): Likewise.
+       (finish_do_stmt): Likewise.
+       (finish_for_cond): Likewise.
+       (finish_for_expr): Likewise.
+       (finish_cleanup): Likewise.
+       (add_decl_stmt): Likewise.
+       (finish_named_return_value): Likewise.
+       (finish_qualified_call_expr): Likewise.
+       * tree.c (perm_manip): Remove.
+       (build_exception_variant): Don't use copy_to_permanent.
+       (permanent_p): Remove.
+       (copy_to_permament): Remove.
+       (build_min_nt): Don't use copy_to_permanent.
+       (build_min): Likewise.
+       (min_tree_cons): Likewise.
+       * typeckc.c (build_static_cast): Likewise.
+       (build_reinterpret_cast): Likewise.
+       (build_const_cast): Likewise.
+       
 1999-09-07  Mark Mitchell  <mark@codesourcery.com>
 
        * decl.c (ggc_p): Set it to 1.
index 5b6e8f5..bba4076 100644 (file)
@@ -3676,8 +3676,6 @@ extern int is_aggr_type_2                 PROTO((tree, tree));
 extern const char *lang_printable_name         PROTO((tree, int));
 extern tree build_exception_variant            PROTO((tree, tree));
 extern tree copy_template_template_parm                PROTO((tree));
-extern tree copy_to_permanent                  PROTO((tree));
-extern tree permanent_p                         PROTO((tree));
 extern void print_lang_statistics              PROTO((void));
 extern void __eprintf
        PROTO((const char *, const char *, unsigned, const char *));
index 9278174..c66ba02 100644 (file)
@@ -5365,11 +5365,6 @@ build_typename_type (context, name, fullname, base_type)
       ggc_add_tree_hash_table_root (&h, 1);
     }
 
-  /* The FULLNAME needs to exist for the life of the hash table, i.e.,
-     for the entire compilation.  */
-  if (!TREE_PERMANENT (fullname))
-    fullname = copy_to_permanent (fullname);
-
   /* Build the TYPENAME_TYPE.  */
   t = make_lang_type (TYPENAME_TYPE);
   TYPE_CONTEXT (t) = FROB_CONTEXT (context);
@@ -6908,7 +6903,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
          tree itype = TYPE_DOMAIN (type);
          if (itype && ! TREE_PERMANENT (itype))
            {
-             itype = build_index_type (copy_to_permanent (TYPE_MAX_VALUE (itype)));
+             itype = build_index_type (TYPE_MAX_VALUE (itype));
              type = build_cplus_array_type (TREE_TYPE (type), itype);
              TREE_TYPE (decl) = type;
            }
@@ -7218,8 +7213,6 @@ grok_reference_init (decl, type, init)
   if (TYPE_SIZE (TREE_TYPE (type)))
     {
       init = convert_from_reference (decl);
-      if (TREE_PERMANENT (decl))
-       init = copy_to_permanent (init);
       SET_DECL_REFERENCE_SLOT (decl, init);
     }
 
@@ -7900,7 +7893,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
   if (processing_template_decl)
     {
       if (init && DECL_INITIAL (decl))
-       DECL_INITIAL (decl) = copy_to_permanent (init);
+       DECL_INITIAL (decl) = init;
       goto finish_end0;
     }
 
index b49dda3..a550a72 100644 (file)
@@ -2444,9 +2444,6 @@ build_new_1 (exp)
          fn = TREE_OPERAND (alloc_expr, 1);
          fn = TREE_OPERAND (fn, 0);
 
-         /* Copy size to the saveable obstack.  */
-         size = mapcar (size, permanent_p);
-
          cleanup = build_op_delete_call (dcode, alloc_node, size, flags, fn);
 
          resume_momentary (yes);
@@ -2654,15 +2651,6 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete,
 
   if (controller)
     {
-      /* The CONTROLLER is a BIND_EXPR.  Such things are always
-        allocated on at least the saveable obstack.  Since we may
-        need to copy this expression to the permanent obstack, we
-        must make sure that the operand is on the same obstack as the
-        BIND_EXPR.  Otherwise, copy_to_permanent will not copy the
-        operand, since it will assume that anything under a permanent
-        node is permanent.  */
-      if (TREE_PERMANENT (controller))
-       body = copy_to_permanent (body);
       TREE_OPERAND (controller, 1) = body;
       return controller;
     }
@@ -3010,9 +2998,6 @@ build_vec_init (decl, base, maxindex, init, from_array)
         on the temporary obstack.  */
       push_obstacks_nochange ();
       resume_temporary_allocation ();
-      /* And MAXINDEX needs to be copied to the current obstack.  It's
-        probably on the momentary obstack now.  */
-      maxindex = mapcar (maxindex, permanent_p);
       e = build_vec_delete_1 (rval,
                              build_binary_op (MINUS_EXPR, maxindex, 
                                               iterator),
index 80e6bf4..9ec4903 100644 (file)
@@ -5820,7 +5820,7 @@ case 340:
 case 341:
 #line 1542 "parse.y"
 { if (processing_template_decl)
-                   yyval.ttype = build_min_nt (COMPONENT_REF, yyvsp[-1].ttype, copy_to_permanent (yyvsp[0].ttype));
+                   yyval.ttype = build_min_nt (COMPONENT_REF, yyvsp[-1].ttype, yyvsp[0].ttype);
                  else
                    yyval.ttype = build_object_ref (yyval.ttype, OP0 (yyvsp[0].ttype), OP1 (yyvsp[0].ttype)); ;
     break;}
index cf69bc1..e12d1b2 100644 (file)
@@ -1540,7 +1540,7 @@ primary:
                { $$ = build_x_component_ref ($$, $2, NULL_TREE, 1); }
        | object overqualified_id  %prec UNARY
                { if (processing_template_decl)
-                   $$ = build_min_nt (COMPONENT_REF, $1, copy_to_permanent ($2));
+                   $$ = build_min_nt (COMPONENT_REF, $1, $2);
                  else
                    $$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); }
        | object unqualified_id '(' nonnull_exprlist ')'
index f248752..a02e17a 100644 (file)
@@ -2604,7 +2604,7 @@ push_template_decl_real (decl, is_friend)
   if (primary)
     DECL_PRIMARY_TEMPLATE (tmpl) = tmpl;
 
-  info = perm_tree_cons (tmpl, copy_to_permanent (args), NULL_TREE);
+  info = perm_tree_cons (tmpl, args, NULL_TREE);
 
   if (DECL_IMPLICIT_TYPEDEF_P (decl))
     {
@@ -3801,7 +3801,6 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
       if (arglist2 == error_mark_node)
        return error_mark_node;
 
-      arglist2 = copy_to_permanent (arglist2);
       TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (parm)
        = perm_tree_cons (template2, arglist2, NULL_TREE);
       TYPE_SIZE (parm) = 0;
@@ -4059,7 +4058,6 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope)
            my_friendly_abort (0);
        }
 
-      arglist = copy_to_permanent (arglist);
       SET_TYPE_TEMPLATE_INFO (t,
                              tree_cons (found, arglist, NULL_TREE));  
       DECL_TEMPLATE_INSTANTIATIONS (template) 
@@ -4706,8 +4704,6 @@ tsubst_friend_function (decl, args)
                      DECL_TI_ARGS (spec) 
                        = add_outermost_template_args (new_friend_args,
                                                       DECL_TI_ARGS (spec));
-                     DECL_TI_ARGS (spec)
-                       = copy_to_permanent (DECL_TI_ARGS (spec));
                    }
 
                  /* Now, since specializations are always supposed to
@@ -5019,11 +5015,6 @@ instantiate_class_template (type)
   if (ANON_AGGR_TYPE_P (pattern))
     SET_ANON_AGGR_TYPE_P (type);
 
-  /* We must copy the arguments to the permanent obstack since
-     during the tsubst'ing below they may wind up in the
-     DECL_TI_ARGS of some instantiated member template.  */
-  args = copy_to_permanent (args);
-
   if (TYPE_BINFO_BASETYPES (pattern))
     {
       tree base_list = NULL_TREE;
@@ -5778,9 +5769,6 @@ tsubst_decl (t, args, type, in_decl)
                break;
              }
 
-           /* We're going to need to keep the ARGVEC, so we copy it
-              here.  */
-           argvec = copy_to_permanent (argvec);
            pop_momentary ();
 
            /* Here, we deal with the peculiar case:
@@ -5900,9 +5888,6 @@ tsubst_decl (t, args, type, in_decl)
           case mentioned above where GEN_TMPL is NULL.  */
        if (gen_tmpl)
          {
-           /* The ARGVEC was built on the momentary obstack.  Make it
-              permanent now.  */
-           argvec = copy_to_permanent (argvec);
            DECL_TEMPLATE_INFO (r) 
              = perm_tree_cons (gen_tmpl, argvec, NULL_TREE);
            SET_DECL_IMPLICIT_INSTANTIATION (r);
@@ -6412,8 +6397,6 @@ tsubst (t, args, complain, in_decl)
          }
 
        max = fold (build_binary_op (MINUS_EXPR, max, integer_one_node));
-       if (!TREE_PERMANENT (max) && !allocation_temporary_p ())
-         max = copy_to_permanent (max);
        return build_index_type (max);
       }
 
@@ -7561,7 +7544,6 @@ instantiate_template (tmpl, targ_ptr)
            }
        }
     }
-  targ_ptr = copy_to_permanent (targ_ptr);
 
   /* substitute template parameters */
   fndecl = tsubst (DECL_RESULT (gen_tmpl), targ_ptr, /*complain=*/1, gen_tmpl);
@@ -8534,7 +8516,7 @@ unify (tparms, targs, parm, arg, strict)
       else
        return 1;
 
-      TREE_VEC_ELT (targs, idx) = copy_to_permanent (arg);
+      TREE_VEC_ELT (targs, idx) = arg;
       return 0;
 
     case POINTER_TYPE:
index c3ce330..d5d3377 100644 (file)
@@ -385,7 +385,7 @@ get_tinfo_fn (type)
   DECL_ARTIFICIAL (d) = 1;
   DECL_NOT_REALLY_EXTERN (d) = 1;
   SET_DECL_TINFO_FN_P (d);
-  TREE_TYPE (name) = copy_to_permanent (type);
+  TREE_TYPE (name) = type;
 
   pushdecl_top_level (d);
   make_function_rtl (d);
@@ -703,7 +703,7 @@ build_dynamic_cast (type, expr)
     return error_mark_node;
   
   if (processing_template_decl)
-    return build_min (DYNAMIC_CAST_EXPR, copy_to_permanent (type), expr);
+    return build_min (DYNAMIC_CAST_EXPR, type, expr);
 
   return convert_from_reference (build_dynamic_cast_1 (type, expr));
 }
index d6099f3..bd44449 100644 (file)
@@ -138,7 +138,7 @@ finish_if_stmt_cond (cond, if_stmt)
       if (last_tree != if_stmt)
        RECHAIN_STMTS_FROM_LAST (if_stmt, IF_COND (if_stmt));
       else
-       IF_COND (if_stmt) = copy_to_permanent (cond);
+       IF_COND (if_stmt) = cond;
     }
   else
     {
@@ -236,7 +236,7 @@ finish_while_stmt_cond (cond, while_stmt)
       if (last_tree != while_stmt)
        RECHAIN_STMTS_FROM_LAST (while_stmt, WHILE_COND (while_stmt)); 
       else
-       TREE_OPERAND (while_stmt, 0) = copy_to_permanent (cond);
+       TREE_OPERAND (while_stmt, 0) = cond;
     }
   else
     {
@@ -311,7 +311,7 @@ finish_do_stmt (cond, do_stmt)
      tree do_stmt;
 {
   if (building_stmt_tree ())
-    DO_COND (do_stmt) = copy_to_permanent (cond);
+    DO_COND (do_stmt) = cond;
   else
     {
       emit_line_note (input_filename, lineno);
@@ -401,7 +401,7 @@ finish_for_cond (cond, for_stmt)
       if (last_tree != for_stmt)
        RECHAIN_STMTS_FROM_LAST (for_stmt, FOR_COND (for_stmt));
       else
-       FOR_COND (for_stmt) = copy_to_permanent (cond);
+       FOR_COND (for_stmt) = cond;
     }
   else
     {
@@ -429,7 +429,7 @@ finish_for_expr (expr, for_stmt)
      tree for_stmt;
 {
   if (building_stmt_tree ())
-    FOR_EXPR (for_stmt) = copy_to_permanent (expr);
+    FOR_EXPR (for_stmt) = expr;
 
   /* Don't let the tree nodes for EXPR be discarded
      by clear_momentary during the parsing of the next stmt.  */
@@ -659,7 +659,7 @@ finish_cleanup (cleanup, try_block)
 {
   if (building_stmt_tree ()) 
     {
-      TRY_HANDLERS (try_block) = copy_to_permanent (cleanup);
+      TRY_HANDLERS (try_block) = cleanup;
       CLEANUP_P (try_block) = 1;
     }
   else
@@ -924,7 +924,6 @@ add_decl_stmt (decl)
   tree decl_stmt;
 
   /* We need the type to last until instantiation time.  */
-  TREE_TYPE (decl) = copy_to_permanent (TREE_TYPE (decl));
   decl_stmt = build_min_nt (DECL_STMT, decl);
   add_tree (decl_stmt);
 }
@@ -990,8 +989,7 @@ finish_named_return_value (return_id, init)
       pushdecl (decl);
 
       if (building_stmt_tree ())
-       add_tree (build_min_nt (RETURN_INIT, return_id,
-                               copy_to_permanent (init)));
+       add_tree (build_min_nt (RETURN_INIT, return_id, init));
       else
        {
          cp_finish_decl (decl, init, NULL_TREE, 0, 0);
@@ -1302,8 +1300,7 @@ finish_qualified_call_expr (fn, args)
      tree args;
 {
   if (processing_template_decl)
-    return build_min_nt (CALL_EXPR, copy_to_permanent (fn), args,
-                        NULL_TREE);
+    return build_min_nt (CALL_EXPR, fn, args, NULL_TREE);
   else
     return build_member_call (TREE_OPERAND (fn, 0),
                              TREE_OPERAND (fn, 1),
index d3878ef..e71cf12 100644 (file)
@@ -30,7 +30,6 @@ Boston, MA 02111-1307, USA.  */
 #include "ggc.h"
 
 static tree bot_manip PROTO((tree));
-static tree perm_manip PROTO((tree));
 static tree build_cplus_array_type_1 PROTO((tree, tree));
 static void list_hash_add PROTO((int, tree));
 static int list_hash PROTO((tree, tree, tree));
@@ -1504,10 +1503,6 @@ build_exception_variant (type, raises)
 
   /* Need to build a new variant.  */
   v = build_type_copy (type);
-
-  if (raises && ! TREE_PERMANENT (raises))
-    raises = copy_to_permanent (raises);
-
   TYPE_RAISES_EXCEPTIONS (v) = raises;
   return v;
 }
@@ -2030,55 +2025,6 @@ mapcar (t, func)
   return NULL_TREE;
 }
 
-/* Returns T if T is allocated on the permanent obstack, NULL_TREE
-   otherwise.  */
-
-tree
-permanent_p (t)
-     tree t;
-{
-  return TREE_PERMANENT (t) ? t : NULL_TREE;
-}
-
-static tree
-perm_manip (t)
-     tree t;
-{
-  if (TREE_PERMANENT (t))
-    return t;
-
-  /* Support `void f () { extern int i; A<&i> a; }' */
-  if ((TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == FUNCTION_DECL)
-      && TREE_PUBLIC (t))
-    {
-      t = copy_node (t);
-
-      /* copy_rtx won't make a new SYMBOL_REF, so call make_decl_rtl again.  */
-      DECL_RTL (t) = 0;
-      make_decl_rtl (t, NULL_PTR, 1);
-
-      return t;
-    }
-  return NULL_TREE;
-}
-
-/* Assuming T is a node built bottom-up, make it all exist on
-   permanent obstack, if it is not permanent already.  */
-
-tree
-copy_to_permanent (t)
-     tree t;
-{
-  if (t == NULL_TREE || TREE_PERMANENT (t))
-    return t;
-
-  push_permanent_obstack ();
-  t = mapcar (t, perm_manip);
-  pop_obstacks ();
-
-  return t;
-}
-
 #ifdef GATHER_STATISTICS
 extern int depth_reached;
 #endif
@@ -2214,7 +2160,7 @@ build_min_nt VPROTO((enum tree_code code, ...))
   for (i = 0; i < length; i++)
     {
       tree x = va_arg (p, tree);
-      TREE_OPERAND (t, i) = copy_to_permanent (x);
+      TREE_OPERAND (t, i) = x;
     }
 
   va_end (p);
@@ -2249,13 +2195,13 @@ build_min VPROTO((enum tree_code code, tree tt, ...))
 
   t = make_node (code);
   length = tree_code_length[(int) code];
-  TREE_TYPE (t) = copy_to_permanent (tt);
+  TREE_TYPE (t) = tt;
   TREE_COMPLEXITY (t) = lineno;
 
   for (i = 0; i < length; i++)
     {
       tree x = va_arg (p, tree);
-      TREE_OPERAND (t, i) = copy_to_permanent (x);
+      TREE_OPERAND (t, i) = x;
     }
 
   va_end (p);
@@ -2273,8 +2219,8 @@ min_tree_cons (purpose, value, chain)
   register struct obstack *ambient_obstack = current_obstack;
   current_obstack = &permanent_obstack;
 
-  node = tree_cons (copy_to_permanent (purpose),
-                   copy_to_permanent (value), chain);
+  node = tree_cons (purpose, value, chain);
+
   current_obstack = ambient_obstack;
   return node;
 }
index 6b0bc3b..68563f8 100644 (file)
@@ -5239,8 +5239,7 @@ build_static_cast (type, expr)
 
   if (processing_template_decl)
     {
-      tree t = build_min (STATIC_CAST_EXPR, copy_to_permanent (type),
-                         expr); 
+      tree t = build_min (STATIC_CAST_EXPR, type, expr); 
       return t;
     }
 
@@ -5332,8 +5331,7 @@ build_reinterpret_cast (type, expr)
 
   if (processing_template_decl)
     {
-      tree t = build_min (REINTERPRET_CAST_EXPR, 
-                         copy_to_permanent (type), expr);
+      tree t = build_min (REINTERPRET_CAST_EXPR, type, expr);
       return t;
     }
 
@@ -5427,8 +5425,7 @@ build_const_cast (type, expr)
 
   if (processing_template_decl)
     {
-      tree t = build_min (CONST_CAST_EXPR, copy_to_permanent (type),
-                         expr);
+      tree t = build_min (CONST_CAST_EXPR, type, expr);
       return t;
     }