* Dubious code in check_global_declarations
@ 2004-10-16 1:03 Jan Hubicka
0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2004-10-16 1:03 UTC (permalink / raw)
To: gcc-patches, rth, gcc
Hi,
check_global_declarations contains a code that unconditionally clears DECL_RTL
of all static variables. I have problems to follow the comment probably
explaining the rationalle of this. My problem is that this code has
counterpart in rest_of_decl_compilation that makes these variables to bypass
cgraph confusing any attempts to do IPA on variables. This is very common
problem for java where DECL_RTL is set for some datastructures produced by the
frontend.
I've bootstrapped and regtested the attached patch to kill both hacks on
i686-pc-gnu-linux without problems.
Can someone shed more light on this issue or would be the patch OK for
mainline?
Honza
2004-10-16 Jan Hubicka <jh@suse.cz>
* passes.c (rest_of_decl_compilation): Kill hack carring about
DECL_RTL_SET_P
* toplev.c (check_global_declarations): Do not clear DECL_RTL.
Index: passes.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/passes.c,v
retrieving revision 2.52
diff -c -3 -p -r2.52 passes.c
*** passes.c 25 Sep 2004 10:05:09 -0000 2.52
--- passes.c 15 Oct 2004 14:56:50 -0000
*************** rest_of_decl_compilation (tree decl,
*** 229,242 ****
&& !DECL_EXTERNAL (decl))
{
if (flag_unit_at_a_time && !cgraph_global_info_ready
! && 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);
--- 229,235 ----
&& !DECL_EXTERNAL (decl))
{
if (flag_unit_at_a_time && !cgraph_global_info_ready
! && TREE_CODE (decl) != FUNCTION_DECL && top_level)
cgraph_varpool_finalize_decl (decl);
else
assemble_variable (decl, top_level, at_end, 0);
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.928
diff -c -3 -p -r1.928 toplev.c
*** toplev.c 13 Oct 2004 18:18:17 -0000 1.928
--- toplev.c 15 Oct 2004 14:56:50 -0000
*************** check_global_declarations (tree *vec, in
*** 813,825 ****
{
decl = vec[i];
- if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
- && ! TREE_ASM_WRITTEN (decl))
- /* Cancel the RTL for this decl so that, if debugging info
- output for global variables is still to come,
- this one will be omitted. */
- SET_DECL_RTL (decl, NULL_RTX);
-
/* Warn about any function
declared static but not defined.
We don't warn about variables,
--- 813,818 ----
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-10-16 0:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-16 1:03 Dubious code in check_global_declarations Jan Hubicka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).