From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 55763 invoked by alias); 6 Oct 2016 13:45:43 -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 55569 invoked by uid 89); 6 Oct 2016 13:45:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 spammy=H*Ad:D*comcast.net, duty, HTo:D*com.cn, HTo:D*cn X-HELO: out28-50.mail.aliyun.com Received: from out28-50.mail.aliyun.com (HELO out28-50.mail.aliyun.com) (115.124.28.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Oct 2016 13:45:24 +0000 X-Alimail-AntiSpam:AC=CONTINUE;BC=0.07643641|-1;FP=0|0|0|0|0|-1|-1|-1;HT=e02c03289;MF=chengang@emindsoft.com.cn;NM=1;PH=DS;RN=9;RT=9;SR=0;TI=SMTPD_---.71Gp9mN_1475761510; Received: from ShengShiZhuChengdeMacBook-Pro.local(mailfrom:chengang@emindsoft.com.cn ip:223.72.80.113) by smtp.aliyun-inc.com(10.147.42.16); Thu, 06 Oct 2016 21:45:11 +0800 Message-ID: <57F6573F.5010003@emindsoft.com.cn> Date: Thu, 06 Oct 2016 13:45:00 -0000 From: Chen Gang User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: chengang@emindsoft.com.cn, law@redhat.com CC: rth@redhat.com, mikestump@comcast.net, gcc-patches@gcc.gnu.org, cmetcalf@ezchip.com, walt@tilera.com, peter.maydell@linaro.org, Chen Gang Subject: Re: [PATCH v3] gcc/config/tilegx/tilegx.c (tilegx_function_profiler): Save r10 to stack before call mcount References: <1465046750-3021-1-git-send-email-chengang@emindsoft.com.cn> In-Reply-To: <1465046750-3021-1-git-send-email-chengang@emindsoft.com.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2016-10/txt/msg00376.txt.bz2 Hello Maintainers: Is this patch OK? Please help check it when you have time (at least for me, it passes all related test and comparation). And I shall continue to find and fix another issues about tilegx. Thanks. On 6/4/16 21:25, chengang@emindsoft.com.cn wrote: > From: Chen Gang > > r10 may also be as parameter stack pointer for the nested function, so > need save it before call mcount. > > Also clean up code: use '!' instead of "== 0" for checking > static_chain_decl and compute_total_frame_size. > > 2016-06-04 Chen Gang > > gcc/ > PR target/71331 > * config/tilegx/tilegx.c (tilegx_function_profiler): Save r10 > to stack before call mcount. > (tilegx_can_use_return_insn_p): Clean up code. > --- > gcc/config/tilegx/tilegx.c | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c > index 06c832c..55161bb 100644 > --- a/gcc/config/tilegx/tilegx.c > +++ b/gcc/config/tilegx/tilegx.c > @@ -3880,8 +3880,8 @@ bool > tilegx_can_use_return_insn_p (void) > { > return (reload_completed > - && cfun->static_chain_decl == 0 > - && compute_total_frame_size () == 0 > + && !cfun->static_chain_decl > + && !compute_total_frame_size () > && tilegx_current_function_is_leaf () > && !crtl->profile && !df_regs_ever_live_p (TILEGX_LINK_REGNUM)); > } > @@ -5507,6 +5507,15 @@ tilegx_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED) > fprintf (file, "\t}\n"); > } > > + if (cfun->static_chain_decl) > + { > + fprintf (file, > + "\t{\n" > + "\taddi\tsp, sp, -8\n" > + "\tst\tsp, r10\n" > + "\t}\n"); > + } > + > if (flag_pic) > { > fprintf (file, > @@ -5524,6 +5533,13 @@ tilegx_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED) > "\t}\n", MCOUNT_NAME); > } > > + if (cfun->static_chain_decl) > + { > + fprintf (file, > + "\taddi\tsp, sp, 8\n" > + "\tld\tr10, sp\n"); > + } > + > tilegx_in_bundle = false; > } > > -- Chen Gang (陈刚) Managing Natural Environments is the Duty of Human Beings. -- Chen Gang (陈刚) Managing Natural Environments is the Duty of Human Beings.