(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
+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.
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 *));
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);
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;
}
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);
}
if (processing_template_decl)
{
if (init && DECL_INITIAL (decl))
- DECL_INITIAL (decl) = copy_to_permanent (init);
+ DECL_INITIAL (decl) = init;
goto finish_end0;
}
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);
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;
}
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),
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;}
{ $$ = 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 ')'
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))
{
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;
my_friendly_abort (0);
}
- arglist = copy_to_permanent (arglist);
SET_TYPE_TEMPLATE_INFO (t,
tree_cons (found, arglist, NULL_TREE));
DECL_TEMPLATE_INSTANTIATIONS (template)
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
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;
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:
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);
}
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);
}
}
}
}
- targ_ptr = copy_to_permanent (targ_ptr);
/* substitute template parameters */
fndecl = tsubst (DECL_RESULT (gen_tmpl), targ_ptr, /*complain=*/1, gen_tmpl);
else
return 1;
- TREE_VEC_ELT (targs, idx) = copy_to_permanent (arg);
+ TREE_VEC_ELT (targs, idx) = arg;
return 0;
case POINTER_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);
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));
}
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
{
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
{
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);
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
{
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. */
{
if (building_stmt_tree ())
{
- TRY_HANDLERS (try_block) = copy_to_permanent (cleanup);
+ TRY_HANDLERS (try_block) = cleanup;
CLEANUP_P (try_block) = 1;
}
else
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);
}
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);
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),
#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));
/* 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;
}
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
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);
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);
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;
}
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;
}
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;
}
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;
}