This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch/rfc: lazy make_decl_rtl
- To: gcc-patches at gcc dot gnu dot org
- Subject: patch/rfc: lazy make_decl_rtl
- From: "Zack Weinberg" <zackw at stanford dot edu>
- Date: Sun, 1 Oct 2000 23:10:42 -0700
This patch attempts to call make_decl_rtl/make_function_rtl only when
we know for sure that the RTL is needed. These functions also adjust
the DECL_ASSEMBLER_NAME of a decl according to some confusing rules,
and that still happens when the decl is finalized. Some of these
adjustments could happen later, but they don't in this patch.
The patch more or less works - I get a load of failures but I cannot
tell if they are due to the patch or some unrelated tree lossage. As
Kaveh noted, a bootstrap with RTL checking on doesn't even pass
compare tests at the moment. So I thought I'd throw this out for
comments as is.
The goal, incidentally, is to prevent creation of structures which are
never used and therefore save memory. On complex C++ input, I think I
can save a couple megs from this and similar changes. Sorry, no
actual numbers yet.
zw
* varasm.c (make_decl_rtl, make_function_rtl): Replace with
adjust_function_name, adjust_decl_name, and x_make_decl_rtl
(temporary name to flush out callers of old function). All
callers adjusted to match.
(make_var_volatile): Delete.
* throughout: Call adjust_function_name/adjust_decl_name
when a decl is created; call x_make_decl_rtl only when we know
we need DECL_RTL of a decl.
===================================================================
Index: c-decl.c
--- c-decl.c 2000/10/01 19:19:23 1.162
+++ c-decl.c 2000/10/02 06:05:53
@@ -1881,18 +1881,7 @@ duplicate_decls (newdecl, olddecl, diffe
TREE_READONLY (write_olddecl) = 1;
if (TREE_THIS_VOLATILE (newdecl))
- {
- TREE_THIS_VOLATILE (write_olddecl) = 1;
- if (TREE_CODE (newdecl) == VAR_DECL
- /* If an automatic variable is re-declared in the same
- function scope, but the old declaration was not
- volatile, make_var_volatile() would crash because the
- variable would have been assigned to a pseudo, not a
- MEM. Since this duplicate declaration is invalid
- anyway, we just skip the call. */
- && errmsg == 0)
- make_var_volatile (newdecl);
- }
+ TREE_THIS_VOLATILE (write_olddecl) = 1;
/* Keep source location of definition rather than declaration. */
/* When called with different_binding_level set, keep the old
@@ -3300,7 +3289,7 @@ builtin_function (name, type, function_c
DECL_BUILT_IN_NONANSI (decl) = 1;
if (library_name)
DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name);
- make_decl_rtl (decl, NULL_PTR, 1);
+ adjust_decl_name (decl, NULL_PTR, 1);
pushdecl (decl);
DECL_BUILT_IN_CLASS (decl) = class;
DECL_FUNCTION_CODE (decl) = function_code;
@@ -6022,7 +6011,7 @@ start_function (declspecs, declarator, p
declare_parm_level (1);
current_binding_level->subblocks_tag_transparent = 1;
- make_function_rtl (current_function_decl);
+ adjust_function_name (current_function_decl);
restype = TREE_TYPE (TREE_TYPE (current_function_decl));
/* Promote the value to int before returning it. */
===================================================================
Index: c-typeck.c
--- c-typeck.c 2000/09/19 14:26:38 1.92
+++ c-typeck.c 2000/10/02 06:05:53
@@ -5146,8 +5146,8 @@ really_start_incremental_init (type)
if (constructor_incremental)
{
- make_decl_rtl (constructor_decl, constructor_asmspec,
- constructor_top_level);
+ adjust_decl_name (constructor_decl, constructor_asmspec,
+ constructor_top_level);
assemble_variable (constructor_decl, constructor_top_level, 0, 1);
defer_addressed_constants ();
===================================================================
Index: calls.c
--- calls.c 2000/09/17 12:45:49 1.158
+++ calls.c 2000/10/02 06:05:53
@@ -1659,6 +1659,9 @@ rtx_for_function_call (fndecl, exp)
}
/* Get a SYMBOL_REF rtx for the function address. */
+ if (DECL_RTL (fndecl) == NULL_RTX)
+ x_make_decl_rtl (fndecl);
+
funexp = XEXP (DECL_RTL (fndecl), 0);
}
else
===================================================================
Index: except.c
--- except.c 2000/10/01 19:19:24 1.136
+++ except.c 2000/10/02 06:05:54
@@ -1146,7 +1146,7 @@ call_get_eh_context ()
TREE_PUBLIC (fn) = 1;
DECL_ARTIFICIAL (fn) = 1;
TREE_READONLY (fn) = 1;
- make_decl_rtl (fn, NULL_PTR, 1);
+ adjust_decl_name (fn, NULL_PTR, 1);
assemble_external (fn);
pop_obstacks ();
===================================================================
Index: expr.c
--- expr.c 2000/09/24 15:34:30 1.264
+++ expr.c 2000/10/02 06:05:55
@@ -1759,7 +1759,7 @@ emit_block_move (x, y, size, align)
DECL_EXTERNAL (fn) = 1;
TREE_PUBLIC (fn) = 1;
DECL_ARTIFICIAL (fn) = 1;
- make_decl_rtl (fn, NULL_PTR, 1);
+ adjust_decl_name (fn, NULL_PTR, 1);
assemble_external (fn);
pop_obstacks ();
}
@@ -2527,7 +2527,7 @@ clear_storage (object, size, align)
DECL_EXTERNAL (fn) = 1;
TREE_PUBLIC (fn) = 1;
DECL_ARTIFICIAL (fn) = 1;
- make_decl_rtl (fn, NULL_PTR, 1);
+ adjust_decl_name (fn, NULL_PTR, 1);
assemble_external (fn);
pop_obstacks ();
}
@@ -3427,6 +3427,10 @@ expand_assignment (to, from, want_value,
return want_value ? result : NULL_RTX;
}
+ /* We might not have DECL_RTL for 'to' yet. */
+ if (TREE_CODE (to) == VAR_DECL && DECL_RTL (to) == NULL_RTX)
+ x_make_decl_rtl (to);
+
/* Assignment of a structure component needs special treatment
if the structure component's rtx is not simply a MEM.
Assignment of an array element at a constant index, and assignment of
@@ -5830,6 +5834,13 @@ expand_expr (exp, target, tmode, modifie
return const0_rtx;
}
+ /* If this is a DECL and it has no DECL_RTL, give it one now. */
+ if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd'
+ && TREE_CODE (exp) != PARM_DECL
+ && TREE_CODE (exp) != LABEL_DECL
+ && DECL_RTL (exp) == NULL_RTX)
+ x_make_decl_rtl (exp);
+
mode = TYPE_MODE (type);
/* Use subtarget as the target for operand 0 of a binary operation. */
subtarget = get_subtarget (target);
@@ -5986,14 +5997,6 @@ expand_expr (exp, target, tmode, modifie
}
case PARM_DECL:
- if (DECL_RTL (exp) == 0)
- {
- error_with_decl (exp, "prior parameter's size depends on `%s'");
- return CONST0_RTX (mode);
- }
-
- /* ... fall through ... */
-
case VAR_DECL:
/* If a static var's type was incomplete when the decl was written,
but the type is complete now, lay out the decl now. */
@@ -6039,8 +6042,6 @@ expand_expr (exp, target, tmode, modifie
case FUNCTION_DECL:
case RESULT_DECL:
- if (DECL_RTL (exp) == 0)
- abort ();
/* Ensure variable marked as used even if it doesn't go through
a parser. If it hasn't be used yet, write out an external
===================================================================
Index: function.c
--- function.c 2000/09/18 21:37:37 1.220
+++ function.c 2000/10/02 06:05:55
@@ -6335,13 +6335,11 @@ expand_function_start (subr, parms_have_
if (current_function_instrument_entry_exit)
{
- rtx fun = DECL_RTL (current_function_decl);
- if (GET_CODE (fun) == MEM)
- fun = XEXP (fun, 0);
- else
- abort ();
+ if (DECL_RTL (current_function_decl) == 0)
+ x_make_decl_rtl (current_function_decl);
+
emit_library_call (profile_function_entry_libfunc, 0, VOIDmode, 2,
- fun, Pmode,
+ XEXP (DECL_RTL (current_function_decl), 0), Pmode,
expand_builtin_return_addr (BUILT_IN_RETURN_ADDRESS,
0,
hard_frame_pointer_rtx),
===================================================================
Index: output.h
--- output.h 2000/05/29 22:02:42 1.51
+++ output.h 2000/10/02 06:05:55
@@ -223,18 +223,18 @@ extern void weak_finish PARAMS ((void)
extern int decode_reg_name PARAMS ((const char *));
#ifdef TREE_CODE
-/* Create the DECL_RTL for a declaration for a static or external variable
- or static or external function.
+/* Create the DECL_RTL for a non-PARM_DECL declaration node. */
+extern void x_make_decl_rtl PARAMS ((tree));
+
+/* Adjust the DECL_ASSEMBLER_NAME of a non-function DECL node.
ASMSPEC, if not 0, is the string which the user specified
as the assembler symbol name.
TOP_LEVEL is nonzero if this is a file-scope variable.
-
- This is never called for PARM_DECL nodes. */
-extern void make_decl_rtl PARAMS ((tree, const char *, int));
+ Not used for PARM_DECL nodes. */
+extern void adjust_decl_name PARAMS ((tree, const char *, int));
-/* Make the rtl for variable VAR be volatile.
- Use this only for static variables. */
-extern void make_var_volatile PARAMS ((tree));
+/* Adjust the DECL_ASSEMBLER_NAME of a function DECL node. */
+extern void adjust_function_name PARAMS ((tree));
/* Output alignment directive to align for constant expression EXP. */
extern void assemble_constant_align PARAMS ((tree));
===================================================================
Index: profile.c
--- profile.c 2000/09/11 01:50:46 1.46
+++ profile.c 2000/10/02 06:05:55
@@ -1116,7 +1116,7 @@ output_func_start_profiler ()
current_function_decl = fndecl;
DECL_INITIAL (fndecl) = error_mark_node;
temporary_allocation ();
- make_function_rtl (fndecl);
+ adjust_function_name (fndecl);
init_function_start (fndecl, input_filename, lineno);
pushlevel (0);
expand_function_start (fndecl, 0);
===================================================================
Index: toplev.c
--- toplev.c 2000/09/25 22:54:04 1.383
+++ toplev.c 2000/10/02 06:05:56
@@ -2547,7 +2547,7 @@ rest_of_decl_compilation (decl, asmspec,
|| TREE_CODE (decl) == FUNCTION_DECL)
{
timevar_push (TV_VARCONST);
- make_decl_rtl (decl, asmspec, top_level);
+ adjust_decl_name (decl, asmspec, top_level);
/* Initialized extern variable exists to be replaced
with its value, or represents something that will be
output in another file. */
@@ -2571,17 +2571,8 @@ rest_of_decl_compilation (decl, asmspec,
}
else if (DECL_REGISTER (decl) && asmspec != 0)
{
- if (decode_reg_name (asmspec) >= 0)
- {
- DECL_RTL (decl) = 0;
- make_decl_rtl (decl, asmspec, top_level);
- }
- else
- {
- error ("invalid register name `%s' for register variable", asmspec);
- DECL_REGISTER (decl) = 0;
- make_decl_rtl (decl, NULL, top_level);
- }
+ DECL_RTL (decl) = 0;
+ adjust_decl_name (decl, asmspec, top_level);
}
#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
@@ -3669,8 +3660,11 @@ rest_of_compilation (decl)
/* Get the function's name, as described by its RTL. This may be
different from the DECL_NAME name used in the source file. */
+ if (DECL_RTL (decl) == NULL_RTX)
+ x_make_decl_rtl (decl);
x = DECL_RTL (decl);
+
if (GET_CODE (x) != MEM)
abort ();
x = XEXP (x, 0);
===================================================================
Index: tree.h
--- tree.h 2000/09/19 18:19:43 1.199
+++ tree.h 2000/10/02 06:05:56
@@ -2803,7 +2803,6 @@ extern void set_yydebug PARAMS ((int))
extern void fixup_signed_type PARAMS ((tree));
/* varasm.c */
-extern void make_decl_rtl PARAMS ((tree, const char *, int));
extern void make_decl_one_only PARAMS ((tree));
extern int supports_one_only PARAMS ((void));
extern void variable_section PARAMS ((tree, int));
===================================================================
Index: varasm.c
--- varasm.c 2000/09/25 11:23:44 1.135
+++ varasm.c 2000/10/02 06:06:04
@@ -511,36 +511,17 @@ exception_section ()
#endif
}
-/* Create the rtl to represent a function, for a function definition.
- DECL is a FUNCTION_DECL node which describes which function.
- The rtl is stored into DECL. */
+/* Possibly adjust the DECL_ASSEMBLER_NAME of this function according to
+ -fprefix-function-name and/or its being a nested function. Usually does
+ nothing. */
void
-make_function_rtl (decl)
+adjust_function_name (decl)
tree decl;
{
- const char *name;
- const char *new_name;
+ const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+ const char *new_name = name;
- if (DECL_RTL (decl) != 0)
- {
- /* ??? Another way to do this would be to do what halfpic.c does
- and maintain a hashed table of such critters. */
- /* ??? Another way to do this would be to pass a flag bit to
- ENCODE_SECTION_INFO saying whether this is a new decl or not. */
- /* Let the target reassign the RTL if it wants.
- This is necessary, for example, when one machine specific
- decl attribute overrides another. */
-#ifdef REDO_SECTION_INFO_P
- if (REDO_SECTION_INFO_P (decl))
- ENCODE_SECTION_INFO (decl);
-#endif
- return;
- }
-
- name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
- new_name = name;
-
/* Rename a nested function to avoid conflicts, unless it's a member of
a local class, in which case the class name is already unique. */
if (decl_function_context (decl) != 0
@@ -573,21 +554,8 @@ make_function_rtl (decl)
DECL_ASSEMBLER_NAME (decl) = get_identifier (new_name);
name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
}
-
- DECL_RTL (decl)
- = gen_rtx_MEM (DECL_MODE (decl),
- gen_rtx_SYMBOL_REF (Pmode, name));
-
- /* Optionally set flags or add text to the name to record
- information such as that it is a function name. If the name
- is changed, the macro ASM_OUTPUT_LABELREF will have to know
- how to strip this information. */
-#ifdef ENCODE_SECTION_INFO
- ENCODE_SECTION_INFO (decl);
-#endif
}
-
/* Given NAME, a putative register name, discard any customary prefixes. */
static const char *
@@ -672,7 +640,7 @@ decode_reg_name (asmspec)
This is never called for PARM_DECL nodes. */
void
-make_decl_rtl (decl, asmspec, top_level)
+adjust_decl_name (decl, asmspec, top_level)
tree decl;
const char *asmspec;
int top_level;
@@ -681,31 +649,6 @@ make_decl_rtl (decl, asmspec, top_level)
const char *new_name = 0;
int reg_number;
- /* For a duplicate declaration, we can be called twice on the
- same DECL node. Don't discard the RTL already made. */
- if (DECL_RTL (decl) != 0)
- {
- /* If the old RTL had the wrong mode, fix the mode. */
- if (GET_MODE (DECL_RTL (decl)) != DECL_MODE (decl))
- {
- rtx rtl = DECL_RTL (decl);
- PUT_MODE (rtl, DECL_MODE (decl));
- }
-
- /* ??? Another way to do this would be to do what halfpic.c does
- and maintain a hashed table of such critters. */
- /* ??? Another way to do this would be to pass a flag bit to
- ENCODE_SECTION_INFO saying whether this is a new decl or not. */
- /* Let the target reassign the RTL if it wants.
- This is necessary, for example, when one machine specific
- decl attribute overrides another. */
-#ifdef REDO_SECTION_INFO_P
- if (REDO_SECTION_INFO_P (decl))
- ENCODE_SECTION_INFO (decl);
-#endif
- return;
- }
-
new_name = name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
reg_number = decode_reg_name (asmspec);
@@ -829,33 +772,54 @@ make_decl_rtl (decl, asmspec, top_level)
|| ((flag_volatile_static && TREE_CODE (decl) == VAR_DECL
&& (TREE_PUBLIC (decl) || TREE_STATIC (decl)))))
TREE_SIDE_EFFECTS (decl) = 1;
+}
+
+/* Create the rtl associated with a DECL node and save it in DECL_RTL (decl).
+ This is (mem (symbol_ref (DECL_ASSEMBLER_NAME decl))). */
+void
+x_make_decl_rtl (decl)
+ tree decl;
+{
+ const char *name;
+
+ if (DECL_RTL (decl) != 0)
+ {
+ /* If the old RTL had the wrong mode, fix the mode. */
+ if (TREE_CODE (decl) != FUNCTION_DECL
+ && GET_MODE (DECL_RTL (decl)) != DECL_MODE (decl))
+ PUT_MODE (DECL_RTL (decl), DECL_MODE (decl));
+
+ /* ??? Another way to do this would be to do what halfpic.c does
+ and maintain a hashed table of such critters. */
+ /* ??? Another way to do this would be to pass a flag bit to
+ ENCODE_SECTION_INFO saying whether this is a new decl or not. */
+ /* Let the target reassign the RTL if it wants.
+ This is necessary, for example, when one machine specific
+ decl attribute overrides another. */
+#ifdef REDO_SECTION_INFO_P
+ if (REDO_SECTION_INFO_P (decl))
+ ENCODE_SECTION_INFO (decl);
+#endif
+ return;
+ }
+
+ name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl),
gen_rtx_SYMBOL_REF (Pmode, name));
+
if (TREE_CODE (decl) != FUNCTION_DECL)
set_mem_attributes (DECL_RTL (decl), decl, 1);
- /* Optionally set flags or add text to the name to record information
- such as that it is a function name.
- If the name is changed, the macro ASM_OUTPUT_LABELREF
- will have to know how to strip this information. */
+ /* Optionally set flags or add text to the name to record
+ information such as that it is a function name. If the name
+ is changed, the macro ASM_OUTPUT_LABELREF will have to know
+ how to strip this information. */
#ifdef ENCODE_SECTION_INFO
ENCODE_SECTION_INFO (decl);
#endif
}
-/* Make the rtl for variable VAR be volatile.
- Use this only for static variables. */
-
-void
-make_var_volatile (var)
- tree var;
-{
- if (GET_CODE (DECL_RTL (var)) != MEM)
- abort ();
-
- MEM_VOLATILE_P (DECL_RTL (var)) = 1;
-}
/* Output alignment directive to align for constant expression EXP. */
@@ -1325,6 +1289,9 @@ assemble_variable (decl, top_level, at_e
last_assemble_variable_decl = 0;
+ if (DECL_RTL (decl) == NULL_RTX)
+ x_make_decl_rtl (decl);
+
if (GET_CODE (DECL_RTL (decl)) == REG)
{
/* Do output symbol info for global register variables, but do nothing
@@ -4737,8 +4704,8 @@ assemble_alias (decl, target)
{
const char *name;
- make_decl_rtl (decl, (char *) 0, 1);
- name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
+ adjust_decl_name (decl, NULL_PTR, 1);
+ name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
#ifdef ASM_OUTPUT_DEF
/* Make name accessible from other files, if appropriate. */
===================================================================
Index: ch/ch-tree.h
--- ch/ch-tree.h 2000/05/09 19:55:48 1.22
+++ ch/ch-tree.h 2000/10/02 06:06:05
@@ -1115,9 +1115,6 @@ extern void announce_function
extern int floor_log2_wide PARAMS ((unsigned HOST_WIDE_INT));
extern void rest_of_compilation PARAMS ((tree));
-/* in varasm.c */
-extern void make_function_rtl PARAMS ((tree));
-
/* in ???? */
extern void init_iterators PARAMS ((void));
extern int mark_addressable PARAMS ((tree));
===================================================================
Index: ch/decl.c
--- ch/decl.c 2000/09/11 01:50:47 1.27
+++ ch/decl.c 2000/10/02 06:06:05
@@ -1227,7 +1227,7 @@ push_extern_function (name, typespec, ar
save_decl (fndecl);
pop_obstacks ();
}
- make_function_rtl (fndecl);
+ adjust_function_name (fndecl);
}
else
{
@@ -4084,7 +4084,7 @@ builtin_function (name, type, function_c
DECL_BUILT_IN_NONANSI (decl) = 1;
if (library_name)
DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name);
- make_decl_rtl (decl, NULL_PTR, 1);
+ adjust_decl_name (decl, NULL_PTR, 1);
pushdecl (decl);
DECL_BUILT_IN_CLASS (decl) = class;
DECL_FUNCTION_CODE (decl) = function_code;
@@ -4973,5 +4973,5 @@ finish_outer_function ()
init_entry_decl,
module_init_list);
- make_decl_rtl (global_function_decl, NULL, 0);
+ adjust_decl_name (global_function_decl, NULL, 0);
}
===================================================================
Index: ch/except.c
--- ch/except.c 2000/03/07 11:41:20 1.14
+++ ch/except.c 2000/10/02 06:06:05
@@ -263,7 +263,7 @@ start_handler_array ()
DECL_INITIAL (decl) = error_mark_node;
pushdecl (decl);
- make_decl_rtl (decl, NULL_PTR, 0);
+ adjust_decl_name (decl, NULL_PTR, 0);
current_handler->handler_array_decl = decl;
return decl;
}
@@ -334,13 +334,13 @@ finish_handler_array ()
temporary data yet. */
pop_obstacks ();
layout_decl (decl, 0);
- /* To prevent make_decl_rtl (called indiectly by rest_of_decl_compilation)
+ /* To prevent adjust_decl_name (called indiectly by rest_of_decl_compilation)
throwing the existing RTL (which has already been used). */
PUT_MODE (DECL_RTL (decl), DECL_MODE (decl));
rest_of_decl_compilation (decl, (char*)0, 0, 0);
expand_decl_init (decl);
#else
- /* To prevent make_decl_rtl (called indirectly by finish_decl)
+ /* To prevent adjust_decl_name (called indirectly by finish_decl)
altering the existing RTL. */
GET_MODE (DECL_RTL (current_handler->handler_array_decl)) =
DECL_MODE (current_handler->handler_array_decl);
@@ -595,7 +595,7 @@ initialize_exceptions ()
DECL_EXTERNAL (exception_stack_decl) = 1;
push_obstacks_nochange ();
pushdecl(exception_stack_decl);
- make_decl_rtl (exception_stack_decl, NULL_PTR, 1);
+ adjust_decl_name (exception_stack_decl, NULL_PTR, 1);
finish_decl (exception_stack_decl);
}
===================================================================
Index: ch/grant.c
--- ch/grant.c 2000/05/09 19:55:48 1.15
+++ ch/grant.c 2000/10/02 06:06:05
@@ -3041,7 +3041,7 @@ chill_finish_compile ()
tasking_registry ();
- make_decl_rtl (current_function_decl, NULL, 1);
+ adjust_decl_name (current_function_decl, NULL, 1);
finish_chill_function ();
===================================================================
Index: ch/inout.c
--- ch/inout.c 2000/08/29 21:39:45 1.14
+++ ch/inout.c 2000/10/02 06:06:05
@@ -1075,7 +1075,7 @@ declare_predefined_file (name, assembler
TREE_PUBLIC (decl) = 1;
DECL_EXTERNAL (decl) = 1;
DECL_IN_SYSTEM_HEADER (decl) = 1;
- make_decl_rtl (decl, 0, 1);
+ adjust_decl_name (decl, 0, 1);
pushdecl (decl);
}
===================================================================
Index: ch/satisfy.c
--- ch/satisfy.c 2000/05/27 15:21:16 1.14
+++ ch/satisfy.c 2000/10/02 06:06:05
@@ -246,7 +246,7 @@ safe_satisfy_decl (decl, prev_chain)
|| TREE_CODE (decl) == CONST_DECL))
{
if (TREE_CODE (decl) == FUNCTION_DECL && decl_function_context (decl))
- make_function_rtl (decl);
+ adjust_function_name (decl);
else if (!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
expand_decl (decl);
else
@@ -263,7 +263,7 @@ safe_satisfy_decl (decl, prev_chain)
IDENTIFIER_POINTER (current_module->prefix_name),
IDENTIFIER_POINTER (DECL_NAME (decl)));
}
- make_decl_rtl (decl, asm_name, TREE_PUBLIC (decl));
+ adjust_decl_name (decl, asm_name, TREE_PUBLIC (decl));
}
}
===================================================================
Index: cp/class.c
--- cp/class.c 2000/09/07 01:36:10 1.338
+++ cp/class.c 2000/10/02 06:06:07
@@ -5130,7 +5130,7 @@ finish_struct_1 (t)
&& TREE_TYPE (x) == t)
{
DECL_MODE (x) = TYPE_MODE (t);
- make_decl_rtl (x, NULL, 0);
+ adjust_decl_name (x, NULL, 0);
}
}
===================================================================
Index: cp/decl.c
--- cp/decl.c 2000/10/01 19:19:25 1.694
+++ cp/decl.c 2000/10/02 06:06:11
@@ -6780,7 +6780,7 @@ builtin_function (name, type, code, clas
pushdecl (decl);
if (libname)
DECL_ASSEMBLER_NAME (decl) = get_identifier (libname);
- make_function_rtl (decl);
+ adjust_function_name (decl);
/* Warn if a function in the namespace for users
is used without an occasion to consider it declared. */
@@ -6818,7 +6818,7 @@ build_library_fn (name, type)
tree type;
{
tree fn = build_library_fn_1 (name, ERROR_MARK, type);
- make_function_rtl (fn);
+ adjust_function_name (fn);
return fn;
}
@@ -6834,7 +6834,7 @@ build_cp_library_fn (name, operator_code
TREE_NOTHROW (fn) = TYPE_NOTHROW_P (type);
DECL_CONTEXT (fn) = FROB_CONTEXT (current_namespace);
set_mangled_name_for_decl (fn);
- make_function_rtl (fn);
+ adjust_function_name (fn);
return fn;
}
@@ -7720,7 +7720,7 @@ check_initializer (decl, init)
else if (!DECL_EXTERNAL (decl) && TREE_CODE (type) == REFERENCE_TYPE)
{
if (TREE_STATIC (decl))
- make_decl_rtl (decl, NULL_PTR, toplevel_bindings_p ());
+ adjust_decl_name (decl, NULL_PTR, toplevel_bindings_p ());
grok_reference_init (decl, type, init);
init = NULL_TREE;
}
@@ -7847,7 +7847,7 @@ make_rtl_for_nonlocal_decl (decl, init,
/* If we're deferring the variable, just make RTL. Do not actually
emit the variable. */
if (defer_p)
- make_decl_rtl (decl, asmspec, toplev);
+ adjust_decl_name (decl, asmspec, toplev);
/* If we're not deferring, go ahead and assemble the variable. */
else
rest_of_decl_compilation (decl, asmspec, toplev, at_eof);
@@ -8128,7 +8128,7 @@ cp_finish_decl (decl, init, asmspec_tree
grokclassfn. Lay this out fresh. */
DECL_RTL (TREE_TYPE (decl)) = NULL_RTX;
DECL_ASSEMBLER_NAME (decl) = get_identifier (asmspec);
- make_decl_rtl (decl, asmspec, 0);
+ adjust_decl_name (decl, asmspec, 0);
}
/* Deduce size of array from initialization, if not already known. */
@@ -13816,7 +13816,7 @@ start_function (declspecs, declarator, a
/* We need to do this even if we aren't expanding yet so that
assemble_external works. */
- make_function_rtl (decl1);
+ adjust_function_name (decl1);
/* Promote the value to int before returning it. */
if (C_PROMOTING_INTEGER_TYPE_P (restype))
===================================================================
Index: cp/decl2.c
--- cp/decl2.c 2000/09/21 21:47:55 1.400
+++ cp/decl2.c 2000/10/02 06:06:12
@@ -2254,7 +2254,7 @@ finish_anon_union (anon_union_decl)
if (static_p)
{
- make_decl_rtl (main_decl, 0, toplevel_bindings_p ());
+ adjust_decl_name (main_decl, 0, toplevel_bindings_p ());
DECL_RTL (anon_union_decl) = DECL_RTL (main_decl);
expand_anon_union_decl (anon_union_decl,
NULL_TREE,
===================================================================
Index: cp/friend.c
--- cp/friend.c 2000/09/17 07:38:20 1.62
+++ cp/friend.c 2000/10/02 06:06:12
@@ -409,7 +409,7 @@ do_friend (ctype, declarator, decl, parm
}
}
- make_decl_rtl (decl, NULL_PTR, 1);
+ adjust_decl_name (decl, NULL_PTR, 1);
add_friend (current_class_type,
is_friend_template ? DECL_TI_TEMPLATE (decl) : decl);
DECL_FRIEND_P (decl) = 1;
===================================================================
Index: cp/init.c
--- cp/init.c 2000/09/17 07:38:20 1.219
+++ cp/init.c 2000/10/02 06:06:12
@@ -2188,7 +2188,7 @@ build_java_class_ref (type)
DECL_ARTIFICIAL (class_decl) = 1;
DECL_IGNORED_P (class_decl) = 1;
pushdecl_top_level (class_decl);
- make_decl_rtl (class_decl, NULL_PTR, 1);
+ adjust_decl_name (class_decl, NULL_PTR, 1);
}
return class_decl;
}
===================================================================
Index: cp/method.c
--- cp/method.c 2000/09/12 06:45:59 1.177
+++ cp/method.c 2000/10/02 06:06:12
@@ -2157,7 +2157,7 @@ make_thunk (function, delta, vcall_index
/* So that finish_file can write out any thunks that need to be: */
pushdecl_top_level (thunk);
/* Create RTL for this thunk so that its address can be taken. */
- make_function_rtl (thunk);
+ adjust_function_name (thunk);
}
return thunk;
}
@@ -2211,6 +2211,14 @@ use_thunk (thunk_fndecl, emit_p)
TREE_ASM_WRITTEN (thunk_fndecl) = 1;
return;
}
+
+ /* We need DECL_RTL for both thunk_fundecl and function.
+ FIXME: Make all ASM_OUTPUT_MI_THUNK definitions use
+ DECL_ASSEMBLER_NAME consistently, then this will not be ncessary. */
+ if (DECL_RTL (thunk_fndecl) == 0)
+ x_make_decl_rtl (thunk_fndecl);
+ if (DECL_RTL (function) == 0)
+ x_make_decl_rtl (function);
push_to_top_level ();
===================================================================
Index: cp/pt.c
--- cp/pt.c 2000/09/17 07:38:20 1.468
+++ cp/pt.c 2000/10/02 06:06:12
@@ -4467,7 +4467,7 @@ tsubst_friend_function (decl, args)
{
set_mangled_name_for_decl (new_friend);
DECL_RTL (new_friend) = 0;
- make_decl_rtl (new_friend, NULL_PTR, 1);
+ adjust_decl_name (new_friend, NULL_PTR, 1);
}
if (DECL_NAMESPACE_SCOPE_P (new_friend))
@@ -5731,7 +5731,7 @@ tsubst_decl (t, args, type, in_decl)
}
DECL_RTL (r) = 0;
- make_decl_rtl (r, NULL_PTR, 1);
+ adjust_decl_name (r, NULL_PTR, 1);
/* Like grokfndecl. If we don't do this, pushdecl will
mess up our TREE_CHAIN because it doesn't find a
===================================================================
Index: cp/semantics.c
--- cp/semantics.c 2000/09/17 07:38:21 1.175
+++ cp/semantics.c 2000/10/02 06:06:13
@@ -2365,7 +2365,7 @@ expand_body (fn)
{
/* Give the function RTL now so that we can assign it to a
function pointer, etc. */
- make_function_rtl (fn);
+ adjust_function_name (fn);
/* Set DECL_EXTERNAL so that assemble_external will be called as
necessary. We'll clear it again in finish_file. */
if (!DECL_EXTERNAL (fn))
===================================================================
Index: f/com.c
--- f/com.c 2000/10/01 19:19:28 1.95
+++ f/com.c 2000/10/02 06:06:14
@@ -6511,7 +6511,7 @@ ffecom_init_zero_ (tree decl)
if (incremental)
{
- make_decl_rtl (decl, NULL, TREE_PUBLIC (decl) ? 1 : 0);
+ adjust_decl_name (decl, NULL, TREE_PUBLIC (decl) ? 1 : 0);
assemble_variable (decl, TREE_PUBLIC (decl) ? 1 : 0, 0, 1);
}
@@ -12401,7 +12401,7 @@ ffecom_lookup_label (ffelab label)
TREE_STATIC (glabel) = 1;
DECL_CONTEXT (glabel) = 0;
DECL_INITIAL (glabel) = NULL;
- make_decl_rtl (glabel, NULL, 0);
+ adjust_decl_name (glabel, NULL, 0);
expand_decl (glabel);
ffecom_save_tree_forever (glabel);
@@ -13710,7 +13710,7 @@ builtin_function (const char *name, tree
TREE_PUBLIC (decl) = 1;
if (library_name)
DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name);
- make_decl_rtl (decl, NULL_PTR, 1);
+ adjust_decl_name (decl, NULL_PTR, 1);
pushdecl (decl);
DECL_BUILT_IN_CLASS (decl) = class;
DECL_FUNCTION_CODE (decl) = function_code;
@@ -13850,11 +13850,7 @@ duplicate_decls (tree newdecl, tree oldd
if (TREE_READONLY (newdecl))
TREE_READONLY (olddecl) = 1;
if (TREE_THIS_VOLATILE (newdecl))
- {
- TREE_THIS_VOLATILE (olddecl) = 1;
- if (TREE_CODE (newdecl) == VAR_DECL)
- make_var_volatile (newdecl);
- }
+ TREE_THIS_VOLATILE (olddecl) = 1;
/* Keep source location of definition rather than declaration.
Likewise, keep decl at outer scope. */
@@ -14636,7 +14632,7 @@ start_function (tree name, tree type, in
if (TREE_CODE (current_function_decl) != ERROR_MARK)
{
- make_function_rtl (current_function_decl);
+ adjust_function_name (current_function_decl);
restype = TREE_TYPE (TREE_TYPE (current_function_decl));
DECL_RESULT (current_function_decl)
===================================================================
Index: java/class.c
--- java/class.c 2000/10/01 19:19:29 1.76
+++ java/class.c 2000/10/02 06:06:14
@@ -866,7 +866,7 @@ build_utf8_ref (name)
pushdecl (decl);
rest_of_decl_compilation (decl, (char*) 0, global_bindings_p (), 0);
utf8_decl_list = decl;
- make_decl_rtl (decl, (char*) 0, 1);
+ adjust_decl_name (decl, (char*) 0, 1);
ref = build1 (ADDR_EXPR, utf8const_ptr_type, decl);
IDENTIFIER_UTF8_REF (name) = ref;
pop_obstacks ();
@@ -904,7 +904,7 @@ build_class_ref (type)
DECL_IGNORED_P (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
DECL_ASSEMBLER_NAME (decl) = mangle_class_field (type);
- make_decl_rtl (decl, NULL, 1);
+ adjust_decl_name (decl, NULL, 1);
pushdecl_top_level (decl);
if (is_compiled == 1)
DECL_EXTERNAL (decl) = 1;
@@ -958,7 +958,7 @@ build_class_ref (type)
decl = build_decl (VAR_DECL, decl_name, class_type_node);
TREE_STATIC (decl) = 1;
TREE_PUBLIC (decl) = 1;
- make_decl_rtl (decl, NULL, 1);
+ adjust_decl_name (decl, NULL, 1);
pushdecl_top_level (decl);
if (is_compiled == 1)
DECL_EXTERNAL (decl) = 1;
@@ -993,7 +993,7 @@ build_static_field_ref (fdecl)
if (DECL_RTL (fdecl) == 0)
{
push_obstacks (&permanent_obstack, &permanent_obstack);
- make_decl_rtl (fdecl, NULL, 1);
+ adjust_decl_name (fdecl, NULL, 1);
pop_obstacks ();
if (is_compiled == 1)
DECL_EXTERNAL (fdecl) = 1;
@@ -1242,7 +1242,7 @@ get_dispatch_table (type, this_class_add
else
{
if (DECL_RTL (method) == 0)
- make_decl_rtl (method, NULL, 1);
+ adjust_decl_name (method, NULL, 1);
method = build1 (ADDR_EXPR, nativecode_ptr_type_node, method);
}
list = tree_cons (NULL_TREE /*DECL_VINDEX (method) + 2*/,
@@ -1997,7 +1997,7 @@ layout_class_method (this_class, super_c
if (! METHOD_ABSTRACT (method_decl)
|| (CLASS_INTERFACE (TYPE_NAME (this_class))
&& (DECL_CLINIT_P (method_decl))))
- make_function_rtl (method_decl);
+ adjust_function_name (method_decl);
obstack_free (&temporary_obstack, asm_name);
if (ID_INIT_P (method_name))
@@ -2094,7 +2094,7 @@ emit_register_classes ()
/* DECL_EXTERNAL (init_decl) = 1;*/
TREE_PUBLIC (init_decl) = 1;
pushlevel (0);
- make_function_rtl (init_decl);
+ adjust_function_name (init_decl);
init_function_start (init_decl, input_filename, 0);
expand_function_start (init_decl, 0);
===================================================================
Index: java/constants.c
--- java/constants.c 2000/09/23 17:09:38 1.13
+++ java/constants.c 2000/10/02 06:06:14
@@ -407,7 +407,7 @@ build_constant_data_ref ()
build_array_type (ptr_type_node,
one_elt_array_domain_type));
TREE_STATIC (decl) = 1;
- make_decl_rtl (decl, NULL, 1);
+ adjust_decl_name (decl, NULL, 1);
pop_obstacks ();
TYPE_CPOOL_DATA_REF (current_class) = current_constant_pool_data_ref
= build1 (ADDR_EXPR, ptr_type_node, decl);
===================================================================
Index: java/decl.c
--- java/decl.c 2000/10/01 19:19:29 1.73
+++ java/decl.c 2000/10/02 06:06:14
@@ -342,7 +342,7 @@ builtin_function (name, type, function_c
TREE_PUBLIC (decl) = 1;
if (library_name)
DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name);
- make_decl_rtl (decl, NULL_PTR, 1);
+ adjust_decl_name (decl, NULL_PTR, 1);
pushdecl (decl);
DECL_BUILT_IN_CLASS (decl) = class;
DECL_FUNCTION_CODE (decl) = function_code;
@@ -360,7 +360,7 @@ create_primitive_vtable (name)
sprintf (buf, "_Jv_%sVTable", name);
r = build_decl (VAR_DECL, get_identifier (buf), ptr_type_node);
DECL_EXTERNAL (r) = 1;
- make_decl_rtl (r, buf, 1);
+ adjust_decl_name (r, buf, 1);
return r;
}
===================================================================
Index: java/expr.c
--- java/expr.c 2000/09/23 17:09:38 1.86
+++ java/expr.c 2000/10/02 06:06:14
@@ -1668,7 +1668,7 @@ build_known_method_ref (method, method_t
tree func;
if (is_compiled_class (self_type))
{
- make_decl_rtl (method, NULL, 1);
+ adjust_decl_name (method, NULL, 1);
func = build1 (ADDR_EXPR, method_ptr_type_node, method);
}
else
@@ -1989,7 +1989,7 @@ build_jni_stub (method)
TREE_STATIC (meth_var) = 1;
TREE_PUBLIC (meth_var) = 0;
DECL_EXTERNAL (meth_var) = 0;
- make_decl_rtl (meth_var, NULL, 0);
+ adjust_decl_name (meth_var, NULL, 0);
meth_var = pushdecl_top_level (meth_var);
pop_obstacks ();
@@ -2354,7 +2354,7 @@ java_lang_expand_expr (exp, target, tmod
DECL_INITIAL (init_decl) = value;
DECL_IGNORED_P (init_decl) = 1;
TREE_READONLY (init_decl) = 1;
- make_decl_rtl (init_decl, NULL, 1);
+ adjust_decl_name (init_decl, NULL, 1);
init = build1 (ADDR_EXPR, TREE_TYPE (exp), init_decl);
r = expand_expr (init, target, tmode, modifier);
pop_obstacks ();
@@ -2379,7 +2379,7 @@ java_lang_expand_expr (exp, target, tmod
DECL_IGNORED_P (init_decl) = 1;
TREE_READONLY (init_decl) = 1;
TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (init_decl)) = 1;
- make_decl_rtl (init_decl, NULL, 1);
+ adjust_decl_name (init_decl, NULL, 1);
pop_obstacks ();
init = init_decl;
}
===================================================================
Index: objc/objc-act.c
--- objc/objc-act.c 2000/09/17 07:38:22 1.51
+++ objc/objc-act.c 2000/10/02 06:06:16
@@ -1240,7 +1240,7 @@ create_builtin_decl (code, type, name)
if (code == VAR_DECL)
{
TREE_STATIC (decl) = 1;
- make_decl_rtl (decl, 0, 1);
+ adjust_decl_name (decl, 0, 1);
pushdecl (decl);
}
@@ -1318,7 +1318,7 @@ synth_module_prologue ()
if (flag_traditional && TAG_MSGSEND[0] != '_')
DECL_BUILT_IN_NONANSI (umsg_decl) = 1;
- make_decl_rtl (umsg_decl, NULL_PTR, 1);
+ adjust_decl_name (umsg_decl, NULL_PTR, 1);
pushdecl (umsg_decl);
}
else
@@ -1994,7 +1994,7 @@ generate_static_references ()
type = build_array_type (build_pointer_type (void_type_node), 0);
decl = build_decl (VAR_DECL, ident, type);
- make_decl_rtl (decl, 0, 1);
+ adjust_decl_name (decl, 0, 1);
TREE_USED (decl) = 1;
decls
= tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, decl, 1), decls);
@@ -2087,7 +2087,7 @@ build_selector_reference_decl ()
DECL_ARTIFICIAL (decl) = 1;
DECL_CONTEXT (decl) = 0;
- make_decl_rtl (decl, 0, 1);
+ adjust_decl_name (decl, 0, 1);
pushdecl_top_level (decl);
return decl;
@@ -2309,7 +2309,7 @@ build_class_reference_decl ()
DECL_CONTEXT (decl) = 0;
DECL_ARTIFICIAL (decl) = 1;
- make_decl_rtl (decl, 0, 1);
+ adjust_decl_name (decl, 0, 1);
pushdecl_top_level (decl);
return decl;
@@ -2452,7 +2452,7 @@ build_objc_string_decl (section)
DECL_CONTEXT (decl) = 0;
DECL_ARTIFICIAL (decl) = 1;
- make_decl_rtl (decl, 0, 1);
+ adjust_decl_name (decl, 0, 1);
pushdecl_top_level (decl);
return decl;
@@ -5355,7 +5355,7 @@ build_protocol_reference (p)
TREE_USED (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
- make_decl_rtl (decl, 0, 1);
+ adjust_decl_name (decl, 0, 1);
pushdecl_top_level (decl);
}