public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: WANG Xuerui <i@xen0n.name>, Lulu Cheng <chenglulu@loongson.cn>,
	 gcc-patches@gcc.gnu.org
Cc: xuchenghua@loongson.cn
Subject: Re: [PATCH] LoongArch: Modify fp_sp_offset and gp_sp_offset's calculation method, when frame->mask or frame->fmask is zero.
Date: Thu, 07 Jul 2022 16:58:50 +0800	[thread overview]
Message-ID: <05d3c1293e6eddf7dcc95dbb09c15c76a8cd25e1.camel@xry111.site> (raw)
In-Reply-To: <d20aebf5-e3a7-e364-9aca-1c5f87fc3e52@xen0n.name>

On Thu, 2022-07-07 at 16:31 +0800, WANG Xuerui wrote:

> IMO it's better to also state which problem this change is meant to 
> solve (i.e. your intent), better yet, with an appropriate bugzilla
> link.

And/or add a testcase (which FAILs without this change) into
gcc/testsuite/gcc.target/loongarch.

> > ---
> >   gcc/config/loongarch/loongarch.cc | 12 +++++++++---
> >   1 file changed, 9 insertions(+), 3 deletions(-)
> > 
> > diff --git a/gcc/config/loongarch/loongarch.cc
> > b/gcc/config/loongarch/loongarch.cc
> > index d72b256df51..5c9a33c14f7 100644
> > --- a/gcc/config/loongarch/loongarch.cc
> > +++ b/gcc/config/loongarch/loongarch.cc
> > @@ -917,8 +917,12 @@ loongarch_compute_frame_info (void)
> >     frame->frame_pointer_offset = offset;
> >     /* Next are the callee-saved FPRs.  */
> >     if (frame->fmask)
> > -    offset += LARCH_STACK_ALIGN (num_f_saved * UNITS_PER_FP_REG);
> > -  frame->fp_sp_offset = offset - UNITS_PER_FP_REG;
> > +    {
> > +      offset += LARCH_STACK_ALIGN (num_f_saved * UNITS_PER_FP_REG);
> > +      frame->fp_sp_offset = offset - UNITS_PER_FP_REG;
> > +    }
> > +  else
> > +    frame->fp_sp_offset = offset;
> >     /* Next are the callee-saved GPRs.  */
> >     if (frame->mask)
> >       {
> > @@ -931,8 +935,10 @@ loongarch_compute_frame_info (void)
> >         frame->save_libcall_adjustment = x_save_size;
> >   
> >         offset += x_save_size;
> > +      frame->gp_sp_offset = offset - UNITS_PER_WORD;
> >       }
> > -  frame->gp_sp_offset = offset - UNITS_PER_WORD;
> > +  else
> > +    frame->gp_sp_offset = offset;
> >     /* The hard frame pointer points above the callee-saved GPRs. 
> > */
> >     frame->hard_frame_pointer_offset = offset;
> >     /* Above the hard frame pointer is the callee-allocated varags
> > save area.  */

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

      reply	other threads:[~2022-07-07  8:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07  8:04 Lulu Cheng
2022-07-07  8:31 ` WANG Xuerui
2022-07-07  8:58   ` Xi Ruoyao [this message]

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=05d3c1293e6eddf7dcc95dbb09c15c76a8cd25e1.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=chenglulu@loongson.cn \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=i@xen0n.name \
    --cc=xuchenghua@loongson.cn \
    /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).