This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] m68k: Don't use a sibcall from an interrupt handler.
- From: Richard Sandiford <richard at codesourcery dot com>
- To: Kazu Hirata <kazu at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org, law at redhat dot com, schwab at suse dot de, nathan at codesourcery dot com
- Date: Sat, 25 Aug 2007 11:29:59 +0100
- Subject: Re: [patch] m68k: Don't use a sibcall from an interrupt handler.
- References: <200708242206.l7OM6g8k011141@sparrowhawk.codesourcery.com>
Kazu Hirata <kazu@codesourcery.com> writes:
> @@ -1255,9 +1254,25 @@ flags_in_68881 (void)
> indirect calls. */
>
> static bool
> -m68k_ok_for_sibcall_p (tree decl ATTRIBUTE_UNUSED, tree exp)
> +m68k_ok_for_sibcall_p (tree decl, tree exp)
> {
> - return TREE_OPERAND (exp, 2) == NULL;
> + enum m68k_function_kind kind;
> +
> + if (TREE_OPERAND (exp, 2))
> + return false;
> +
> + kind = m68k_get_function_kind (current_function_decl);
> + if (kind == m68k_fk_normal_function)
> + /* We can always sibcall from a normal function, because it's
> + undefined if it is calling an interrupt function. */
> + return true;
> +
> + /* Otherwise we can only sibcall if the function kind is known to be
> + the same. */
> + if (decl && m68k_get_function_kind (decl) == kind)
> + return true;
> +
> + return false;
Minor nit, but the comment for this function is:
/* Implement TARGET_FUNCTION_OK_FOR_SIBCALL_P. We cannot use sibcalls
for nested functions because we use the static chain register for
indirect calls. */
Now that the function is checking for more than nested functions,
the second sentence seems out of place. I think you should move it
above the TREE_OPERAND check instead. (I'm sure I'm not the only one
who has no idea what TREE_OPERAND (exp, 2) is testing without that
comment to explain things.)
Richard