aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-09-08 20:12:35 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-09-08 20:12:35 +0000
commit2a1e9fdd031c5fcdc35b78d4bb6b9800cb82eafc (patch)
treeadf9be1d936c0ca1288a7994361c1272e150dc7e /gcc
parentce3700e3ba57f07a44a2edc9d8b146a7682bb54e (diff)
downloadgcc-2a1e9fdd031c5fcdc35b78d4bb6b9800cb82eafc.zip
gcc-2a1e9fdd031c5fcdc35b78d4bb6b9800cb82eafc.tar.gz
gcc-2a1e9fdd031c5fcdc35b78d4bb6b9800cb82eafc.tar.bz2
cp-tree.h (copy_to_permanent): Remove.
* 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. From-SVN: r29211
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog43
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/decl.c11
-rw-r--r--gcc/cp/init.c15
-rw-r--r--gcc/cp/parse.c2
-rw-r--r--gcc/cp/parse.y2
-rw-r--r--gcc/cp/pt.c22
-rw-r--r--gcc/cp/rtti.c4
-rw-r--r--gcc/cp/semantics.c19
-rw-r--r--gcc/cp/tree.c64
-rw-r--r--gcc/cp/typeck.c9
11 files changed, 67 insertions, 126 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 578202a..4b689de 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 5b6e8f5..bba4076 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -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 *));
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 9278174..c66ba02 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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;
}
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index b49dda3..a550a72 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -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),
diff --git a/gcc/cp/parse.c b/gcc/cp/parse.c
index 80e6bf45..9ec4903 100644
--- a/gcc/cp/parse.c
+++ b/gcc/cp/parse.c
@@ -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;}
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y
index cf69bc1..e12d1b2 100644
--- a/gcc/cp/parse.y
+++ b/gcc/cp/parse.y
@@ -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 ')'
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f248752..a02e17a 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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:
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index c3ce330..d5d3377 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -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));
}
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index d6099f3..bd44449 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -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),
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index d3878ef..e71cf12 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -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;
}
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 6b0bc3b..68563f8 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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;
}