From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72965 invoked by alias); 9 Jul 2015 11:12:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 72900 invoked by uid 89); 9 Jul 2015 11:12:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-oi0-f46.google.com Received: from mail-oi0-f46.google.com (HELO mail-oi0-f46.google.com) (209.85.218.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 09 Jul 2015 11:12:07 +0000 Received: by oibp128 with SMTP id p128so25521237oib.3 for ; Thu, 09 Jul 2015 04:12:06 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.182.20.141 with SMTP id n13mr14712364obe.26.1436440325941; Thu, 09 Jul 2015 04:12:05 -0700 (PDT) Received: by 10.76.160.68 with HTTP; Thu, 9 Jul 2015 04:12:05 -0700 (PDT) In-Reply-To: References: <20150709105439.GA19247@gmail.com> Date: Thu, 09 Jul 2015 11:12:00 -0000 Message-ID: Subject: Re: [PATCH] PR target/66819: Allow indirect sibcall with register arguments From: "H.J. Lu" To: Uros Bizjak Cc: "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg00727.txt.bz2 On Thu, Jul 9, 2015 at 4:04 AM, Uros Bizjak wrote: > On Thu, Jul 9, 2015 at 12:54 PM, H.J. Lu 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.