Commit 23dfa477 by Zack Weinberg Committed by Zack Weinberg

tree.h (TREE_SET_PERMANENT): New macro.

	* 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'.

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

From-SVN: r32128
parent 1e59bcc3
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> 2000-02-24 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* config/c4x/c4x.c (c4x_process_after_reload): Split all insns. * config/c4x/c4x.c (c4x_process_after_reload): Split all insns.
......
...@@ -3490,18 +3490,9 @@ c_get_alias_set (t) ...@@ -3490,18 +3490,9 @@ c_get_alias_set (t)
} }
if (!TYPE_ALIAS_SET_KNOWN_P (type)) if (!TYPE_ALIAS_SET_KNOWN_P (type))
{ /* TYPE is something we haven't seen before. Put it in a new
/* Types that are not global ('permanent') are not alias set. */
placed in the type hash table. Thus, there can be multiple TYPE_ALIAS_SET (type) = new_alias_set ();
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 ();
}
return TYPE_ALIAS_SET (type); return TYPE_ALIAS_SET (type);
} }
......
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> Sat Feb 19 18:43:13 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* com.c (ffecom_sym_transform): Use DECL_SIZE_UNIT. * com.c (ffecom_sym_transform): Use DECL_SIZE_UNIT.
......
...@@ -444,9 +444,6 @@ static tree ffecom_type_localvar_ (ffesymbol s, ...@@ -444,9 +444,6 @@ static tree ffecom_type_localvar_ (ffesymbol s,
ffeinfoBasictype bt, ffeinfoBasictype bt,
ffeinfoKindtype kt); ffeinfoKindtype kt);
static tree ffecom_type_namelist_ (void); 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_type_vardesc_ (void);
static tree ffecom_vardesc_ (ffebld expr); static tree ffecom_vardesc_ (ffebld expr);
static tree ffecom_vardesc_array_ (ffesymbol s); static tree ffecom_vardesc_array_ (ffesymbol s);
...@@ -9502,41 +9499,6 @@ ffecom_type_namelist_ () ...@@ -9502,41 +9499,6 @@ ffecom_type_namelist_ ()
#endif #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. */ /* Build Vardesc type. */
#if FFECOM_targetCURRENT == FFECOM_targetGCC #if FFECOM_targetCURRENT == FFECOM_targetGCC
...@@ -14095,9 +14057,6 @@ finish_decl (tree decl, tree init, bool is_top_level) ...@@ -14095,9 +14057,6 @@ finish_decl (tree decl, tree init, bool is_top_level)
0); 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)) if (!(TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl))
&& temporary && temporary
/* DECL_INITIAL is not defined in PARM_DECLs, since it shares space with /* 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) ...@@ -14121,11 +14080,6 @@ finish_decl (tree decl, tree init, bool is_top_level)
if (TREE_READONLY (decl)) if (TREE_READONLY (decl))
{ {
preserve_initializer (); 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 /* The initializer and DECL must have the same (or equivalent
types), but if the initializer is a STRING_CST, its type types), but if the initializer is a STRING_CST, its type
......
...@@ -1354,13 +1354,6 @@ build_objc_string_object (strings) ...@@ -1354,13 +1354,6 @@ build_objc_string_object (strings)
TREE_SET_CODE (string, STRING_CST); TREE_SET_CODE (string, STRING_CST);
length = TREE_STRING_LENGTH (string) - 1; 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}) */ /* & ((NXConstantString) {0, string, length}) */
initlist = build_tree_list (NULL_TREE, build_int_2 (0, 0)); initlist = build_tree_list (NULL_TREE, build_int_2 (0, 0));
......
...@@ -301,7 +301,7 @@ print_node (file, prefix, node, indent) ...@@ -301,7 +301,7 @@ print_node (file, prefix, node, indent)
fputs (" used", file); fputs (" used", file);
if (TREE_RAISES (node)) if (TREE_RAISES (node))
fputs (" raises", file); fputs (" raises", file);
if (TREE_PERMANENT (node)) if (!ggc_p && TREE_PERMANENT (node))
fputs (" permanent", file); fputs (" permanent", file);
if (TREE_PUBLIC (node)) if (TREE_PUBLIC (node))
fputs (" public", file); fputs (" public", file);
......
...@@ -892,6 +892,8 @@ init_tree_codes () ...@@ -892,6 +892,8 @@ init_tree_codes ()
/* Return a newly allocated node of code CODE. /* Return a newly allocated node of code CODE.
Initialize the node's unique id and its TREE_PERMANENT flag. 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. For decl and type nodes, some other fields are initialized.
The rest of the node is initialized to zero. The rest of the node is initialized to zero.
...@@ -1048,8 +1050,7 @@ make_node (code) ...@@ -1048,8 +1050,7 @@ make_node (code)
#endif #endif
TREE_SET_CODE (t, code); TREE_SET_CODE (t, code);
if (obstack == &permanent_obstack) TREE_SET_PERMANENT (t);
TREE_PERMANENT (t) = 1;
switch (type) switch (type)
{ {
...@@ -1061,8 +1062,7 @@ make_node (code) ...@@ -1061,8 +1062,7 @@ make_node (code)
case 'd': case 'd':
if (code != FUNCTION_DECL) if (code != FUNCTION_DECL)
DECL_ALIGN (t) = 1; DECL_ALIGN (t) = 1;
DECL_IN_SYSTEM_HEADER (t) DECL_IN_SYSTEM_HEADER (t) = in_system_header;
= in_system_header && (obstack == &permanent_obstack);
DECL_SOURCE_LINE (t) = lineno; DECL_SOURCE_LINE (t) = lineno;
DECL_SOURCE_FILE (t) = DECL_SOURCE_FILE (t) =
(input_filename) ? input_filename : built_in_filename; (input_filename) ? input_filename : built_in_filename;
...@@ -1215,7 +1215,7 @@ copy_node (node) ...@@ -1215,7 +1215,7 @@ copy_node (node)
TYPE_SYMTAB_ADDRESS (t) = 0; TYPE_SYMTAB_ADDRESS (t) = 0;
} }
TREE_PERMANENT (t) = (current_obstack == &permanent_obstack); TREE_SET_PERMANENT (t);
return t; return t;
} }
...@@ -1608,8 +1608,7 @@ make_tree_vec (len) ...@@ -1608,8 +1608,7 @@ make_tree_vec (len)
TREE_SET_CODE (t, TREE_VEC); TREE_SET_CODE (t, TREE_VEC);
TREE_VEC_LENGTH (t) = len; TREE_VEC_LENGTH (t) = len;
if (obstack == &permanent_obstack) TREE_SET_PERMANENT (t);
TREE_PERMANENT (t) = 1;
return t; return t;
} }
...@@ -2114,10 +2113,8 @@ tree_cons (purpose, value, chain) ...@@ -2114,10 +2113,8 @@ tree_cons (purpose, value, chain)
tree_node_sizes[(int)x_kind] += sizeof (struct tree_list); tree_node_sizes[(int)x_kind] += sizeof (struct tree_list);
#endif #endif
TREE_SET_CODE (node, TREE_LIST); TREE_SET_CODE (node, TREE_LIST);
if (current_obstack == &permanent_obstack) TREE_SET_PERMANENT (node);
TREE_PERMANENT (node) = 1;
TREE_CHAIN (node) = chain; TREE_CHAIN (node) = chain;
TREE_PURPOSE (node) = purpose; TREE_PURPOSE (node) = purpose;
...@@ -3209,9 +3206,7 @@ build1 (code, type, node) ...@@ -3209,9 +3206,7 @@ build1 (code, type, node)
TREE_TYPE (t) = type; TREE_TYPE (t) = type;
TREE_SET_CODE (t, code); TREE_SET_CODE (t, code);
TREE_SET_PERMANENT (t);
if (obstack == &permanent_obstack)
TREE_PERMANENT (t) = 1;
TREE_OPERAND (t, 0) = node; TREE_OPERAND (t, 0) = node;
if (node && first_rtl_op (code) != 0) if (node && first_rtl_op (code) != 0)
......
...@@ -563,8 +563,14 @@ extern void tree_class_check_failed PARAMS ((const tree, char, ...@@ -563,8 +563,14 @@ extern void tree_class_check_failed PARAMS ((const tree, char,
/* Nonzero means permanent node; /* Nonzero means permanent node;
node will continue to exist for the entire compiler run. 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_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 INTEGER_TYPE or ENUMERAL_TYPE nodes, means an unsigned type.
In FIELD_DECL nodes, means an unsigned bit field. In FIELD_DECL nodes, means an unsigned bit field.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment