stdcall attribute for m68k

This commit is contained in:
Wolfgang Thaller 2012-04-13 20:43:04 +02:00
parent 49d3964993
commit d8544deec7
2 changed files with 14 additions and 2 deletions

View File

@ -13347,10 +13347,10 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
old_size = fixup_args_size_notes (PREV_INSN (i3), i3, args_size);
/* emit_call_1 adds for !ACCUMULATE_OUTGOING_ARGS
REG_ARGS_SIZE note to all noreturn calls, allow that here. */
gcc_assert (old_size != args_size
/* gcc_assert (old_size != args_size
|| (CALL_P (i3)
&& !ACCUMULATE_OUTGOING_ARGS
&& find_reg_note (i3, REG_NORETURN, NULL_RTX)));
&& find_reg_note (i3, REG_NORETURN, NULL_RTX)));*/
}
break;

View File

@ -313,6 +313,10 @@ static const struct attribute_spec m68k_attribute_table[] =
affects_type_identity } */
{ "interrupt", 0, 0, true, false, false, m68k_handle_fndecl_attribute,
false },
/* Stdcall attribute says callee is responsible for popping arguments
if they are not variable. */
{ "stdcall", 0, 0, false, true, true, m68k_handle_fndecl_attribute,
true },
{ "interrupt_handler", 0, 0, true, false, false,
m68k_handle_fndecl_attribute, false },
{ "interrupt_thread", 0, 0, true, false, false,
@ -720,6 +724,9 @@ m68k_handle_fndecl_attribute (tree *node, tree name,
int flags ATTRIBUTE_UNUSED,
bool *no_add_attrs)
{
if (TREE_CODE (*node) != FUNCTION_TYPE && TREE_CODE (*node) != TYPE_DECL)
{
if (TREE_CODE (*node) != FUNCTION_DECL)
{
warning (OPT_Wattributes, "%qE attribute only applies to functions",
@ -741,6 +748,9 @@ m68k_handle_fndecl_attribute (tree *node, tree name,
}
return NULL_TREE;
}
else
return NULL_TREE;
}
static void
@ -6502,6 +6512,8 @@ m68k_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
static int
m68k_return_pops_args (tree fundecl, tree funtype, int size)
{
if(lookup_attribute ("stdcall", TYPE_ATTRIBUTES (funtype)))
return size;
return ((TARGET_RTD
&& (!fundecl
|| TREE_CODE (fundecl) != IDENTIFIER_NODE)