__magicinline__ attribute to suppress cse on magic_inline functions

This commit is contained in:
Wolfgang Thaller 2014-09-22 21:33:21 +02:00
parent a73165f37f
commit 54d890514a
2 changed files with 18 additions and 22 deletions

View File

@ -132,8 +132,7 @@ static int stack_arg_under_construction;
static void emit_call_1 (rtx, tree, tree, tree, HOST_WIDE_INT, HOST_WIDE_INT, static void emit_call_1 (rtx, tree, tree, tree, HOST_WIDE_INT, HOST_WIDE_INT,
HOST_WIDE_INT, rtx, rtx, int, rtx, int, HOST_WIDE_INT, rtx, rtx, int, rtx, int,
cumulative_args_t, cumulative_args_t,
int is_pascal, bool is_pascal);
enum machine_mode pascal_return_mode);
static void precompute_register_parameters (int, struct arg_data *, int *); static void precompute_register_parameters (int, struct arg_data *, int *);
static int store_one_arg (struct arg_data *, rtx, int, int, int); static int store_one_arg (struct arg_data *, rtx, int, int, int);
static void store_unaligned_arguments_into_pseudos (struct arg_data *, int); static void store_unaligned_arguments_into_pseudos (struct arg_data *, int);
@ -190,18 +189,14 @@ prepare_call_address (tree fndecl, rtx funexp, rtx static_chain_value,
{ {
#ifndef NO_FUNCTION_CSE #ifndef NO_FUNCTION_CSE
int is_magic = 0; int is_magic = 0;
tree decl = fndecl;//SYMBOL_REF_DECL(funexp);
if(decl)
{
if(DECL_NAME(decl))
{
if(!strncmp(IDENTIFIER_POINTER (DECL_NAME (decl)), "__magic_inline_", 15))
{
is_magic = 1;
}
}
}
if (fndecl)
{
tree fntype = TREE_TYPE(fndecl);
if(fntype && lookup_attribute ("__magicinline__", TYPE_ATTRIBUTES (fntype)))
is_magic = 1;
}
if (optimize && ! flag_no_function_cse && !is_magic) if (optimize && ! flag_no_function_cse && !is_magic)
funexp = force_reg (Pmode, funexp); funexp = force_reg (Pmode, funexp);
#endif #endif
@ -275,8 +270,7 @@ emit_call_1 (rtx funexp, tree fntree ATTRIBUTE_UNUSED, tree fndecl ATTRIBUTE_UNU
int old_inhibit_defer_pop, rtx call_fusage, int ecf_flags, int old_inhibit_defer_pop, rtx call_fusage, int ecf_flags,
cumulative_args_t args_so_far ATTRIBUTE_UNUSED, cumulative_args_t args_so_far ATTRIBUTE_UNUSED,
int is_pascal, bool is_pascal)
enum machine_mode pascal_return_mode)
{ {
rtx rounded_stack_size_rtx = GEN_INT (rounded_stack_size); rtx rounded_stack_size_rtx = GEN_INT (rounded_stack_size);
rtx call_insn, call, funmem; rtx call_insn, call, funmem;
@ -2359,7 +2353,7 @@ expand_call (tree exp, rtx target, int ignore)
rtx static_chain_value; rtx static_chain_value;
/* Nonzero if this is a call to a pascal-declared function. */ /* Nonzero if this is a call to a pascal-declared function. */
int is_pascal = 0 /* ### */; bool is_pascal = false /* ### */;
/* The mode of the value being returned by a pascal-declared function. */ /* The mode of the value being returned by a pascal-declared function. */
enum machine_mode pascal_return_mode = VOIDmode; enum machine_mode pascal_return_mode = VOIDmode;
@ -2387,7 +2381,7 @@ expand_call (tree exp, rtx target, int ignore)
struct_value = targetm.calls.struct_value_rtx (fntype, 0); struct_value = targetm.calls.struct_value_rtx (fntype, 0);
if(lookup_attribute ("pascal", TYPE_ATTRIBUTES (fntype))) if(lookup_attribute ("pascal", TYPE_ATTRIBUTES (fntype)))
is_pascal = 1; is_pascal = true;
/* Warn if this value is an aggregate type, /* Warn if this value is an aggregate type,
@ -3239,7 +3233,7 @@ expand_call (tree exp, rtx target, int ignore)
emit_call_1 (funexp, exp, fndecl, funtype, unadjusted_args_size, emit_call_1 (funexp, exp, fndecl, funtype, unadjusted_args_size,
adjusted_args_size.constant, struct_value_size, adjusted_args_size.constant, struct_value_size,
next_arg_reg, valreg, old_inhibit_defer_pop, call_fusage, next_arg_reg, valreg, old_inhibit_defer_pop, call_fusage,
flags, args_so_far, is_pascal, pascal_return_mode); flags, args_so_far, is_pascal);
/* If the call setup or the call itself overlaps with anything /* If the call setup or the call itself overlaps with anything
of the argument setup we probably clobbered our call address. of the argument setup we probably clobbered our call address.
@ -4267,7 +4261,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
VOIDmode, void_type_node, true), VOIDmode, void_type_node, true),
valreg, valreg,
old_inhibit_defer_pop + 1, call_fusage, flags, args_so_far, old_inhibit_defer_pop + 1, call_fusage, flags, args_so_far,
0, VOIDmode /*is_pascal, pascal_return_mode*/); false /*is_pascal*/);
/* Right-shift returned value if necessary. */ /* Right-shift returned value if necessary. */
if (!pcc_struct_value if (!pcc_struct_value

View File

@ -318,6 +318,8 @@ static const struct attribute_spec m68k_attribute_table[] =
if they are not variable. */ if they are not variable. */
{ "pascal", 0, 0, false, true, true, m68k_handle_fndecl_attribute, { "pascal", 0, 0, false, true, true, m68k_handle_fndecl_attribute,
true }, true },
{ "magicinline", 0, 0, false, true, true, m68k_handle_fndecl_attribute,
false },
{ "interrupt_handler", 0, 0, true, false, false, { "interrupt_handler", 0, 0, true, false, false,
m68k_handle_fndecl_attribute, false }, m68k_handle_fndecl_attribute, false },
{ "interrupt_thread", 0, 0, true, false, false, { "interrupt_thread", 0, 0, true, false, false,
@ -6508,8 +6510,8 @@ m68k_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
static int static int
m68k_return_pops_args (tree fundecl, tree funtype, int size) m68k_return_pops_args (tree fundecl, tree funtype, int size)
{ {
if(lookup_attribute ("pascal", TYPE_ATTRIBUTES (funtype))) if (lookup_attribute ("pascal", TYPE_ATTRIBUTES (funtype)))
return size; return size;
return ((TARGET_RTD return ((TARGET_RTD
&& (!fundecl && (!fundecl
|| TREE_CODE (fundecl) != IDENTIFIER_NODE) || TREE_CODE (fundecl) != IDENTIFIER_NODE)
@ -6569,7 +6571,7 @@ m68k_write_macsbug_name(FILE *file, const char *name)
fprintf(file, "\t.byte 0x80\n\t.byte %d\n", len); fprintf(file, "\t.byte 0x80\n\t.byte %d\n", len);
ASM_OUTPUT_ASCII(file, name, len); ASM_OUTPUT_ASCII(file, name, len);
fprintf(file, "\t.align 2,0\n\t.short 0\n", len); fprintf(file, "\t.align 2,0\n\t.short 0\n");
} }