This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[cs] darwin-related patches to clear rtl
- From: Per Bothner <per at bothner dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 17 Dec 2003 22:29:49 -0800
- Subject: [cs] darwin-related patches to clear rtl
Darwin encodes pic-related properties in the RTX name;
this is used to generate stubs and indirections.
If a decl becomes defined, it destructively modifies
the existing symbol_rtx in place. This may be wrong
for a later compile, which *should* use indirection.
So, these patches reduce DECL_RTL sharing and fix
some related problems.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
2003-12-17 Per Bothner <pbothner@apple.com>
* c-decl.c (lang_clear_identifier): Clear the DECL_RTL of the id's
IDENTIFIER_SYMBOL_VALUE. This is needed at least for Darwin, which
encodes in the rtx name whether the decl is defined.
(duplicate_decls): Don't copy the rtl; we can't safely use it.
* config/darwin.c (machopic_classify_ident): Using
maybe_get_identifier doesn't since it may get a name from previous
output file when using the compile server.
(machopic_finish): Reset machopic_defined_list.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.417.2.14
diff -u -p -r1.417.2.14 c-decl.c
--- c-decl.c 15 Dec 2003 19:09:14 -0000 1.417.2.14
+++ c-decl.c 18 Dec 2003 06:00:32 -0000
@@ -488,7 +488,12 @@ lang_clear_identifier (cpp_reader *pfile
tree t;
if (TREE_CODE (tnode) != IDENTIFIER_NODE)
abort();
- IDENTIFIER_SYMBOL_VALUE (tnode) = NULL_TREE;
+ t = IDENTIFIER_SYMBOL_VALUE (tnode);
+ if (t != NULL)
+ {
+ SET_DECL_RTL (t, NULL);
+ IDENTIFIER_SYMBOL_VALUE (tnode) = NULL_TREE;
+ }
t = IDENTIFIER_TAG_VALUE (tnode);
if (t != NULL)
{
@@ -1465,9 +1470,6 @@ duplicate_decls (tree newdecl, tree oldd
DECL_USER_ALIGN (newdecl) |= DECL_ALIGN (olddecl);
}
}
-
- /* Keep the old rtl since we can safely use it. */
- COPY_DECL_RTL (olddecl, newdecl);
/* Merge the type qualifiers. */
if (TREE_READONLY (newdecl))
Index: config/darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.40.2.4
diff -u -p -r1.40.2.4 darwin.c
--- config/darwin.c 11 Dec 2003 22:20:33 -0000 1.40.2.4
+++ config/darwin.c 18 Dec 2003 06:00:33 -0000
@@ -120,6 +120,7 @@ machopic_classify_ident (tree ident)
else if (name[1] == 'T')
return MACHOPIC_DEFINED_FUNCTION;
+#if 0 /* This doesn't work if using a compile server. */
/* It is possible that someone is holding a "stale" name, which has
since been defined. See if there is a "defined" name (i.e,
different from NAME only in having a '!D_' or a '!T_' instead of
@@ -135,6 +136,7 @@ machopic_classify_ident (tree ident)
return (name[1] == 'd') ? MACHOPIC_DEFINED_DATA
: MACHOPIC_DEFINED_FUNCTION;
}
+#endif
for (temp = machopic_defined_list; temp != NULL_TREE; temp = TREE_CHAIN (temp))
{
@@ -958,6 +960,7 @@ machopic_finish (FILE *asm_out_file)
}
machopic_stubs = NULL_TREE;
machopic_non_lazy_pointers = NULL_TREE;
+ machopic_defined_list = NULL_TREE;
}
int