This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: don't clear DECL_RTL of a DECL_REGISTER decl
On Jul 8, 2004, Richard Henderson <rth@redhat.com> wrote:
> On Thu, Jul 08, 2004 at 09:31:51PM -0300, Alexandre Oliva wrote:
>> * toplev.c (check_global_declarations): Don't clear the DECL_RTL
>> of a register variable.
> I think you should set TREE_ASM_WRITTEN instead.
This would prevent assemble_variable() from being called if it happens
to be handled by the unit-at-a-time code, that skips the call if
TREE_ASM_WRITTEN.
Can't call assemble_variable() from make_decl_rtl(), because we don't
have all the args to pass down.
The only reasonable solution I could come up with was to force
assemble_variable() to be called immediately, instead of the cgraph
declaration handler, if we have a DECL_RTL already set for the var.
Doing otherwise would give check_global_declarations() a chance to
clear it, which we can't let it do.
Ok to install if it bootstraps?
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* passes.c (rest_of_decl_compilation): Don't defer call of
assemble_variable if its DECL_RTL is already set.
Index: gcc/passes.c
===================================================================
RCS file: /cvs/uberbaum/gcc/passes.c,v
retrieving revision 2.29
diff -u -p -r2.29 passes.c
--- gcc/passes.c 8 Jul 2004 07:41:59 -0000 2.29
+++ gcc/passes.c 9 Jul 2004 03:33:23 -0000
@@ -370,7 +370,14 @@ rest_of_decl_compilation (tree decl,
&& !DECL_EXTERNAL (decl))
{
if (flag_unit_at_a_time && !cgraph_global_info_ready
- && TREE_CODE (decl) != FUNCTION_DECL && top_level)
+ && TREE_CODE (decl) != FUNCTION_DECL && top_level
+ /* If we defer processing of decls that have had their
+ DECL_RTL set above (say, in make_decl_rtl),
+ check_global_declarations() will clear it before
+ assemble_variable has a chance to act on it. This
+ would remove all traces of the register name in a
+ global register variable, for example. */
+ && !DECL_RTL_SET_P (decl))
cgraph_varpool_finalize_decl (decl);
else
assemble_variable (decl, top_level, at_end, 0);
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}