Commit 549f0725 by Richard Henderson Committed by Richard Henderson

ia64.c (ia64_encode_section_info): Exit early for global register variables...

        * config/ia64/ia64.c (ia64_encode_section_info): Exit early
        for global register variables; don't special case __[CD]TOR_LIST__;
        mind ggc_p for string allocation.

From-SVN: r33776
parent 4fb9b830
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
* flow.c (init_propagate_block_info): Watch out for conditional * flow.c (init_propagate_block_info): Watch out for conditional
branch to next instruction, and thus one outgoing edge. branch to next instruction, and thus one outgoing edge.
* config/ia64/ia64.c (ia64_encode_section_info): Exit early
for global register variables; don't special case __[CD]TOR_LIST__;
mind ggc_p for string allocation.
2000-05-08 Nick Clifton <nickc@cygnus.com> 2000-05-08 Nick Clifton <nickc@cygnus.com>
* config/i386/i386.h (ELIMINABLE_REGS): Fix comment. * config/i386/i386.h (ELIMINABLE_REGS): Fix comment.
......
...@@ -2823,8 +2823,21 @@ void ...@@ -2823,8 +2823,21 @@ void
ia64_encode_section_info (decl) ia64_encode_section_info (decl)
tree decl; tree decl;
{ {
const char *symbol_str;
if (TREE_CODE (decl) == FUNCTION_DECL) if (TREE_CODE (decl) == FUNCTION_DECL)
{
SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
return;
}
/* Careful not to prod global register variables. */
if (TREE_CODE (decl) != VAR_DECL
|| GET_CODE (DECL_RTL (decl)) != SYMBOL_REF)
return;
symbol_str = XSTR (XEXP (DECL_RTL (decl), 0), 0);
/* We assume that -fpic is used only to create a shared library (dso). /* We assume that -fpic is used only to create a shared library (dso).
With -fpic, no global data can ever be sdata. With -fpic, no global data can ever be sdata.
Without -fpic, global common uninitialized data can never be sdata, since Without -fpic, global common uninitialized data can never be sdata, since
...@@ -2832,8 +2845,7 @@ ia64_encode_section_info (decl) ...@@ -2832,8 +2845,7 @@ ia64_encode_section_info (decl)
/* ??? Actually, we can put globals in sdata, as long as we don't use gprel /* ??? Actually, we can put globals in sdata, as long as we don't use gprel
to access them. The linker may then be able to do linker relaxation to to access them. The linker may then be able to do linker relaxation to
optimize references to them. Currently sdata implies use of gprel. */ optimize references to them. Currently sdata implies use of gprel. */
else if (! TARGET_NO_SDATA if (! TARGET_NO_SDATA
&& TREE_CODE (decl) == VAR_DECL
&& TREE_STATIC (decl) && TREE_STATIC (decl)
&& ! (DECL_ONE_ONLY (decl) || DECL_WEAK (decl)) && ! (DECL_ONE_ONLY (decl) || DECL_WEAK (decl))
&& ! (TREE_PUBLIC (decl) && ! (TREE_PUBLIC (decl)
...@@ -2850,34 +2862,31 @@ ia64_encode_section_info (decl) ...@@ -2850,34 +2862,31 @@ ia64_encode_section_info (decl)
".sbss"))) ".sbss")))
{ {
int size = int_size_in_bytes (TREE_TYPE (decl)); int size = int_size_in_bytes (TREE_TYPE (decl));
const char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0);
/* ??? We should redeclare CTOR_LIST, DTOR_END so that we don't have to
special case them here. Currently we put them in ctor/dtors sections
behind the compiler's back. We should use section attributes
instead. */
if (! strcmp (str, "__CTOR_LIST__")
|| ! strcmp (str, "__DTOR_END__"))
;
/* If the variable has already been defined in the output file, then it /* If the variable has already been defined in the output file, then it
is too late to put it in sdata if it wasn't put there in the first is too late to put it in sdata if it wasn't put there in the first
place. The test is here rather than above, because if it is already place. The test is here rather than above, because if it is already
in sdata, then it can stay there. */ in sdata, then it can stay there. */
else if (TREE_ASM_WRITTEN (decl)) if (TREE_ASM_WRITTEN (decl))
; ;
/* If this is an incomplete type with size 0, then we can't put it in /* If this is an incomplete type with size 0, then we can't put it in
sdata because it might be too big when completed. */ sdata because it might be too big when completed. */
else if (size > 0 && size <= ia64_section_threshold else if (size > 0 && size <= ia64_section_threshold
&& str[0] != SDATA_NAME_FLAG_CHAR) && symbol_str[0] != SDATA_NAME_FLAG_CHAR)
{ {
int len = strlen (str); int len = strlen (symbol_str);
char *newstr = obstack_alloc (saveable_obstack, len + 2); char *newstr;
if (ggc_p)
newstr = ggc_alloc_string (NULL, len + 1);
else
newstr = obstack_alloc (saveable_obstack, len + 2);
strcpy (newstr + 1, str);
*newstr = SDATA_NAME_FLAG_CHAR; *newstr = SDATA_NAME_FLAG_CHAR;
memcpy (newstr + 1, symbol_str, len + 1);
XSTR (XEXP (DECL_RTL (decl), 0), 0) = newstr; XSTR (XEXP (DECL_RTL (decl), 0), 0) = newstr;
} }
} }
...@@ -2885,16 +2894,13 @@ ia64_encode_section_info (decl) ...@@ -2885,16 +2894,13 @@ ia64_encode_section_info (decl)
be; one likely explanation for this is that the decl has been be; one likely explanation for this is that the decl has been
moved into a different section from the one it was in when moved into a different section from the one it was in when
ENCODE_SECTION_INFO was first called. Remove the '@'.*/ ENCODE_SECTION_INFO was first called. Remove the '@'.*/
else if (TREE_CODE (decl) == VAR_DECL else if (symbol_str[0] == SDATA_NAME_FLAG_CHAR)
&& (XSTR (XEXP (DECL_RTL (decl), 0), 0)[0]
== SDATA_NAME_FLAG_CHAR))
{ {
const char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0); if (ggc_p)
int len = strlen (str); XSTR (XEXP (DECL_RTL (decl), 0), 0)
char *newstr = obstack_alloc (saveable_obstack, len); = ggc_alloc_string (symbol_str + 1, -1);
else
strcpy (newstr, str + 1); XSTR (XEXP (DECL_RTL (decl), 0), 0) = symbol_str + 1;
XSTR (XEXP (DECL_RTL (decl), 0), 0) = newstr;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment