public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard@codesourcery.com>
To: Kazu Hirata <kazu@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org,  law@redhat.com,  schwab@suse.de,
	 nathan@codesourcery.com
Subject: Re: [patch] m68k: Don't use a sibcall from an interrupt handler.
Date: Sat, 25 Aug 2007 11:09:00 -0000	[thread overview]
Message-ID: <87y7fzq53s.fsf@firetop.home> (raw)
In-Reply-To: <200708242206.l7OM6g8k011141@sparrowhawk.codesourcery.com> (Kazu 	Hirata's message of "Fri\, 24 Aug 2007 15\:06\:42 -0700")

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

  reply	other threads:[~2007-08-25 10:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-24 22:43 Kazu Hirata
2007-08-25 11:09 ` Richard Sandiford [this message]
2007-08-25 15:14   ` Kazu Hirata

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y7fzq53s.fsf@firetop.home \
    --to=richard@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kazu@codesourcery.com \
    --cc=law@redhat.com \
    --cc=nathan@codesourcery.com \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).