This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] m68k: Don't use a sibcall from an interrupt handler.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]