From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20886 invoked by alias); 16 Jul 2019 10:38:44 -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 20877 invoked by uid 89); 16 Jul 2019 10:38:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SEM_URI,SEM_URIRED autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Jul 2019 10:38:43 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E70172B; Tue, 16 Jul 2019 03:38:41 -0700 (PDT) Received: from [10.2.206.47] (e120808-lin.cambridge.arm.com [10.2.206.47]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 868BC3F71A; Tue, 16 Jul 2019 03:38:41 -0700 (PDT) Subject: Re: [ARM/FDPIC v5 07/21] [ARM] FDPIC: Avoid saving/restoring r9 on stack since it is read-only To: Christophe Lyon , "gcc-patches@gcc.gnu.org" References: <20190515124006.25840-1-christophe.lyon@st.com> <20190515124006.25840-8-christophe.lyon@st.com> From: Kyrill Tkachov Message-ID: <3de89d6b-23a6-36b2-38fc-c983635b053d@foss.arm.com> Date: Tue, 16 Jul 2019 10:42:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: <20190515124006.25840-8-christophe.lyon@st.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2019-07/txt/msg01106.txt.bz2 On 5/15/19 1:39 PM, Christophe Lyon wrote: > 2019-XX-XX  Christophe Lyon >         Mickaël Guêné > >         gcc/ >         * config/arm/arm.h (PIC_REGISTER_MAY_NEED_SAVING): New helper. >         * config/arm/arm.c (arm_compute_save_reg0_reg12_mask): Handle >         FDPIC. > Ok once the rest of the series is approved. Thanks, Kyrill > Change-Id: I0f3b2023ab2a2a0433dfe081dac6bbb194b7a76c > > diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c > index d9397b5..dbd1671 100644 > --- a/gcc/config/arm/arm.c > +++ b/gcc/config/arm/arm.c > @@ -19651,9 +19651,7 @@ arm_compute_save_reg0_reg12_mask (void) >            save_reg_mask |= (1 << reg); > >        /* Also save the pic base register if necessary.  */ > -      if (flag_pic > -         && !TARGET_SINGLE_PIC_BASE > -         && arm_pic_register != INVALID_REGNUM > +      if (PIC_REGISTER_MAY_NEED_SAVING >            && crtl->uses_pic_offset_table) >          save_reg_mask |= 1 << PIC_OFFSET_TABLE_REGNUM; >      } > @@ -19685,9 +19683,7 @@ arm_compute_save_reg0_reg12_mask (void) > >        /* If we aren't loading the PIC register, >           don't stack it even though it may be live.  */ > -      if (flag_pic > -         && !TARGET_SINGLE_PIC_BASE > -         && arm_pic_register != INVALID_REGNUM > +      if (PIC_REGISTER_MAY_NEED_SAVING >            && (df_regs_ever_live_p (PIC_OFFSET_TABLE_REGNUM) >                || crtl->uses_pic_offset_table)) >          save_reg_mask |= 1 << PIC_OFFSET_TABLE_REGNUM; > diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h > index 7b50ef5..45c0e2b 100644 > --- a/gcc/config/arm/arm.h > +++ b/gcc/config/arm/arm.h > @@ -1967,6 +1967,13 @@ extern unsigned arm_pic_register; >                     || label_mentioned_p (get_pool_constant > (X)))))       \ >           || tls_mentioned_p (X)) > > +/* We may want to save the PIC register if it is a dedicated one.  */ > +#define PIC_REGISTER_MAY_NEED_SAVING                   \ > +  (flag_pic                                            \ > +   && !TARGET_SINGLE_PIC_BASE                          \ > +   && !TARGET_FDPIC                                    \ > +   && arm_pic_register != INVALID_REGNUM) > + >  /* We need to know when we are making a constant pool; this determines >     whether data needs to be in the GOT or can be referenced via a GOT >     offset.  */ > -- > 2.6.3 >