From: Jan Hubicka <jh@suse.cz>
To: gcc-patches@gcc.gnu.org, rth@redhat.com, gcc@gcc.gnu.org
Subject: Dubious code in check_global_declarations
Date: Sat, 16 Oct 2004 01:03:00 -0000 [thread overview]
Message-ID: <20041016005735.GH9118@kam.mff.cuni.cz> (raw)
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 ----
reply other threads:[~2004-10-16 0:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041016005735.GH9118@kam.mff.cuni.cz \
--to=jh@suse.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=gcc@gcc.gnu.org \
--cc=rth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).