This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH to simplify make_decl_rtl
- From: Per Bothner <per at bothner dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 04 Jun 2004 09:17:31 -0700
- Subject: PATCH to simplify make_decl_rtl
This patch resulted from trying to figure out how the target
callback encode_section_info should work - is it ok to just
"smash" the old SYMBOL_REF's XSTR in place, as may targets do?
The answer is clearly yes for the two places that the callback
is called on a fresh clearly-unshared DECL_RTL. It is less
clear if it is safe or desirable on the remaining site where
it is called on an existing DECL_RTL. But I though about the
changes that encode_section_info might do to a DECL_RTL, and
I doubted that all the callsbacks could robustly handle being
called twice on the same decl. So I thought that it would
probably be simpler and more robust to get rid of the special
handling for DECL_RTL_SET_P in make_decl_rtl.
It seems to work. Bootstrapped on Fedora 2. It actually fixes
one C++ failure (builtins9.C), and 5 Java failures, though it
appears to add a new Java failure. I think that's a fair trade.
I also appear to get a working linux-x-mingw compiler.
OK to check into mainline?
--
--Per Bothner
per@bothner.com http://per.bothner.com/
2004-06-04 Per Bothner <per@bothner.com>
* varasm.c (make_decl_rtl): Remove special handling if DECL_RTL_SET_P.
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.428
diff -u -p -r1.428 varasm.c
--- varasm.c 30 May 2004 18:32:31 -0000 1.428
+++ varasm.c 4 Jun 2004 15:48:12 -0000
@@ -761,32 +761,6 @@ make_decl_rtl (tree decl, const char *as
|| TREE_CODE (decl) == LABEL_DECL)
abort ();
- /* For a duplicate declaration, we can be called twice on the
- same DECL node. Don't discard the RTL already made. */
- if (DECL_RTL_SET_P (decl))
- {
- /* If the old RTL had the wrong mode, fix the mode. */
- if (GET_MODE (DECL_RTL (decl)) != DECL_MODE (decl))
- SET_DECL_RTL (decl, adjust_address_nv (DECL_RTL (decl),
- DECL_MODE (decl), 0));
-
- /* ??? Another way to do this would be to maintain a hashed
- table of such critters. Instead of adding stuff to a DECL
- to give certain attributes to it, we could use an external
- hash map from DECL to set of attributes. */
-
- /* Let the target reassign the RTL if it wants.
- This is necessary, for example, when one machine specific
- decl attribute overrides another. */
- targetm.encode_section_info (decl, DECL_RTL (decl), false);
-
- /* Make this function static known to the mudflap runtime. */
- if (flag_mudflap && TREE_CODE (decl) == VAR_DECL)
- mudflap_enqueue_decl (decl);
-
- return;
- }
-
reg_number = decode_reg_name (asmspec);
if (reg_number == -2)
{