public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] PR target/66819: Allow indirect sibcall with register arguments
Date: Thu, 09 Jul 2015 11:12:00 -0000	[thread overview]
Message-ID: <CAMe9rOoCOT-1wLSfMLErZ7JXdjGGTF8SVunnwZbbtSW-=D5d1g@mail.gmail.com> (raw)
In-Reply-To: <CAFULd4Zve1oxD3FASe0tAbZhheweXWxKrTn0LpTYRGM8EgHxDA@mail.gmail.com>

On Thu, Jul 9, 2015 at 4:04 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Thu, Jul 9, 2015 at 12:54 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> Indirect sibcall with register arguments is OK when there is register
>> available for argument passing.
>>
>> OK for trunk if there is no regression?
>>
>>
>> H.J.
>> ---
>> gcc/
>>
>>         PR target/66819
>>         * config/i386/i386.c (ix86_function_ok_for_sibcall): Allow
>>         indirect sibcall with register arguments if register available
>>         for argument passing.
>>         (init_cumulative_args): Set cfun->machine->arg_reg_available_p
>>         to cum->nregs != 0.
>>         (function_arg_advance_32): Set cfun->machine->arg_reg_available_p
>>         to 0 when setting cum->nregs = 0.
>>         * config/i386/i386.h (machine_function): Add arg_reg_available_p.
>>
>> gcc/testsuite/
>>
>>         PR target/66819
>>         * gcc.target/i386/pr66819-1.c: New test.
>>         * gcc.target/i386/pr66819-2.c: Likewise.
>>         * gcc.target/i386/pr66819-3.c: Likewise.
>>         * gcc.target/i386/pr66819-4.c: Likewise.
>>         * gcc.target/i386/pr66819-5.c: Likewise.
>> ---
>>  gcc/config/i386/i386.c                    | 15 +++++++++------
>>  gcc/config/i386/i386.h                    |  3 +++
>>  gcc/testsuite/gcc.target/i386/pr66819-1.c |  8 ++++++++
>>  gcc/testsuite/gcc.target/i386/pr66819-2.c |  8 ++++++++
>>  gcc/testsuite/gcc.target/i386/pr66819-3.c | 10 ++++++++++
>>  gcc/testsuite/gcc.target/i386/pr66819-4.c | 12 ++++++++++++
>>  gcc/testsuite/gcc.target/i386/pr66819-5.c | 10 ++++++++++
>>  7 files changed, 60 insertions(+), 6 deletions(-)
>>  create mode 100644 gcc/testsuite/gcc.target/i386/pr66819-1.c
>>  create mode 100644 gcc/testsuite/gcc.target/i386/pr66819-2.c
>>  create mode 100644 gcc/testsuite/gcc.target/i386/pr66819-3.c
>>  create mode 100644 gcc/testsuite/gcc.target/i386/pr66819-4.c
>>  create mode 100644 gcc/testsuite/gcc.target/i386/pr66819-5.c
>>
>> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
>> index 54ee6f3..85e59a8 100644
>> --- a/gcc/config/i386/i386.c
>> +++ b/gcc/config/i386/i386.c
>> @@ -5628,12 +5628,12 @@ ix86_function_ok_for_sibcall (tree decl, tree exp)
>>        if (!decl
>>           || (TARGET_DLLIMPORT_DECL_ATTRIBUTES && DECL_DLLIMPORT_P (decl)))
>>         {
>> -         if (ix86_function_regparm (type, NULL) >= 3)
>> -           {
>> -             /* ??? Need to count the actual number of registers to be used,
>> -                not the possible number of registers.  Fix later.  */
>> -             return false;
>> -           }
>> +         /* FIXME: The symbol indirect call doesn't need a
>> +            call-clobbered register.  But we don't know if
>> +            this is a symbol indirect call or not  here.  */
>> +         if (ix86_function_regparm (type, NULL) >= 3
>> +             && !cfun->machine->arg_reg_available_p)
>> +           return false;
>>         }
>>      }
>
> Why can't we directly look at nregs != 0 in the above code? AFAICS,
> nregs accurately tracks number of available argument registers.
>

I tried it first.  But nregs isn't accessible from ix86_function_ok_for_sibcall.

-- 
H.J.

  reply	other threads:[~2015-07-09 11:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09 10:54 H.J. Lu
2015-07-09 11:04 ` Uros Bizjak
2015-07-09 11:12   ` H.J. Lu [this message]
2015-07-10 16:30 ` Uros Bizjak
2015-07-10 17:10   ` H.J. Lu
2015-07-10 17:21     ` Uros Bizjak
2015-07-10 17:58       ` H.J. Lu
2015-07-10 19:54         ` Uros Bizjak

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='CAMe9rOoCOT-1wLSfMLErZ7JXdjGGTF8SVunnwZbbtSW-=D5d1g@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ubizjak@gmail.com \
    /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).