[RFC] use symbol_ref flags for rs6000
Richard Henderson
rth@redhat.com
Thu Apr 24 00:25:00 GMT 2003
On Wed, Apr 23, 2003 at 04:16:48PM -0700, Janis Johnson wrote:
> It's not correct that current_file_function_operand() always returns
> false when SYMBOL_REF_FLAG is set; that is checked as part of an ||.
Ok, lets look again:
funexp = XEXP (DECL_RTL (function), 0);
SYMBOL_REF_FLAG (funexp) = 0;
if (current_file_function_operand (funexp, VOIDmode)
==>
return (GET_CODE (op) == SYMBOL_REF
&& (SYMBOL_REF_FLAG (op)
|| (op == XEXP (DECL_RTL (current_function_decl), 0)
&& ! DECL_WEAK (current_function_decl))));
Note that function != current_function_decl during output_mi_thunk.
Ever. If that were true we would be generating an infinite loop.
So we get:
return (1
&& (0
|| (0
&& x)));
==>
return 0;
Incidentally, there is a latent buglet here. We should *not* be
checking DECL_WEAK of current_function_decl. Recursion always
binds locally. (If the symbol doesn't get chosen, then we'll never
arrive in this instance of the function to begin with.)
> The symbols that are now flagged with SYMBOL_FLAG_SMALL_V4 are treated
> very differently from the generic small data symbols.
How's that? Aww, nevermind. I'll let that go for now. We'll
let some ppc-eabi maintainer worry about it.
> -static const char * rs6000_xcoff_strip_name_encoding PARAMS ((const char *));
Bug.
> - SYMBOL_REF_FLAG (new_ref) = SYMBOL_REF_FLAG (operands[1]);
> + SYMBOL_REF_FLAGS (new_ref) = SYMBOL_REF_FLAGS (operands[1]);
> SYMBOL_REF_USED (new_ref) = SYMBOL_REF_USED (operands[1]);
Should copy SYMBOL_REF_DECL here as well.
> @@ -12950,22 +12947,18 @@ rs6000_elf_encode_section_info (decl, rt
> if (!first)
> return;
>
> + default_encode_section_info (decl, rtl, first);
Should re-call default_encode_section_info (and any other bit
twiddling that doesn't depend solely on function/non-function)
even if !first. For instance,
extern int i;
extern int i __attribute__((visibility("hidden")));
should result in "i" being marked LOCAL. If we skip after first,
this won't happen.
> @@ -13643,7 +13607,7 @@ rs6000_xcoff_encode_section_info (decl,
> {
> if (TREE_CODE (decl) == FUNCTION_DECL
> && (*targetm.binds_local_p) (decl))
> - SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
> + SYMBOL_REF_FLAGS (XEXP (rtl, 0)) |= SYMBOL_FLAG_LOCAL;
You should be able to delete rs6000_xcoff_encode_section_info
entirely. The predicate that they are checking is
SYMBOL_REF_LOCAL_P (x) && SYMBOL_REF_FUNCTION_P (x)
And given that this is used only in calls, you may or may not
need to check SYMBOL_REF_FUNCTION_P at all. (Test case for this
should be does
void foo()
{
static int thunk[6];
((void (*)(void))thunk)();
}
link.)
> #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
> { rtx sym_ref = XEXP (DECL_RTL (DECL), 0); \
> if ((*targetm.binds_local_p) (DECL)) \
> - SYMBOL_REF_FLAG (sym_ref) = 1; \
> + SYMBOL_REF_FLAGS (sym_ref) |= SYMBOL_FLAG_LOCAL; \
This bit frobbing should not be needed any longer. We call
encode_section_info again during start_function, which should
set SYMBOL_FLAG_LOCAL as appropriate.
r~
More information about the Gcc-patches
mailing list