ia64.c (ia64_encode_section_info): Handle the case where this function is called for the second time on a decl...

2000-05-02  Andrew Haley  <aph@cygnus.com>

        * config/ia64/ia64.c (ia64_encode_section_info): Handle the case
        where this function is called for the second time on a decl that
        has had its section info changed in such a way as to move it out
        of small data/bss.
        * config/ia64/ia64.h (REDO_SECTION_INFO_P): New definition.

From-SVN: r33609
This commit is contained in:
Andrew Haley 2000-05-02 13:50:25 +00:00 committed by Andrew Haley
parent 2b84225632
commit 32adf8e626
3 changed files with 35 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2000-05-02 Andrew Haley <aph@cygnus.com>
* config/ia64/ia64.c (ia64_encode_section_info): Handle the case
where this function is called for the second time on a decl that
has had its section info changed in such a way as to move it out
of small data/bss.
* config/ia64/ia64.h (REDO_SECTION_INFO_P): New definition.
2000-05-01 Richard Henderson <rth@cygnus.com>
* ifcvt.c (dead_or_predicable): Set merge_bb->end to the insn before

View File

@ -2786,6 +2786,7 @@ ia64_encode_section_info (decl)
else if (! TARGET_NO_SDATA
&& TREE_CODE (decl) == VAR_DECL
&& TREE_STATIC (decl)
&& ! (DECL_ONE_ONLY (decl) || DECL_WEAK (decl))
&& ! (TREE_PUBLIC (decl)
&& (flag_pic
|| (DECL_COMMON (decl)
@ -2813,7 +2814,8 @@ ia64_encode_section_info (decl)
/* 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. */
else if (size > 0 && size <= ia64_section_threshold)
else if (size > 0 && size <= ia64_section_threshold
&& str[0] != SDATA_NAME_FLAG_CHAR)
{
int len = strlen (str);
char *newstr = obstack_alloc (saveable_obstack, len + 2);
@ -2822,6 +2824,21 @@ ia64_encode_section_info (decl)
*newstr = SDATA_NAME_FLAG_CHAR;
XSTR (XEXP (DECL_RTL (decl), 0), 0) = newstr;
}
}
/* This decl is marked as being in small data/bss but it shouldn't
be; one likely explanation for this is that the decl has been
moved into a different section from the one it was in when
ENCODE_SECTION_INFO was first called. Remove the '@'.*/
else if (TREE_CODE (decl) == VAR_DECL
&& (XSTR (XEXP (DECL_RTL (decl), 0), 0)[0]
== SDATA_NAME_FLAG_CHAR))
{
char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0);
int len = strlen (str);
char *newstr = obstack_alloc (saveable_obstack, len);
strcpy (newstr, str + 1);
XSTR (XEXP (DECL_RTL (decl), 0), 0) = newstr;
}
}

View File

@ -1978,6 +1978,15 @@ do { \
#define ENCODE_SECTION_INFO(DECL) ia64_encode_section_info (DECL)
/* If a variable is weakened, made one only or moved into a different
section, it may be necessary to redo the section info to move the
variable out of sdata. */
#define REDO_SECTION_INFO_P(DECL) \
((TREE_CODE (DECL) == VAR_DECL) \
&& (DECL_ONE_ONLY (decl) || DECL_WEAK (decl) || DECL_COMMON (decl) \
|| DECL_SECTION_NAME (decl) != 0))
#define SDATA_NAME_FLAG_CHAR '@'
#define IA64_DEFAULT_GVALUE 8