public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andras Tantos <andras@tantosonline.com>
To: Richard Sandiford <richard.sandiford@arm.com>
Cc: gcc@gcc.gnu.org
Subject: Re: How to generate a call inst. sequence?
Date: Thu, 20 Jan 2022 15:47:55 -0800	[thread overview]
Message-ID: <68513876d24698f479260a083443f999a8b50fc7.camel@tantosonline.com> (raw)
In-Reply-To: <mptbl08ovg7.fsf@arm.com>

On Wed, 2022-01-19 at 10:45 +0000, Richard Sandiford wrote:
> Andras Tantos <andras@tantosonline.com> writes:
> > All,
> > 
> > I'm working on porting GCC to a processor architecture that doesn't
> > have 
> > a (HW) stack nor a call instruction. This means that for calls, I
> > need 
> > to generate the following instruction sequence:
> > 
> >      // move stack-pointer:
> >      $sp <- $sp-4
> >      // load return address:
> >      $r3 <- return_label
> >      // store return address on stack:
> >      mem[$sp] <- $r3
> >      // jump to callee:
> >      $pc <- <address_of_function>
> 
> Even though this is internally a jump, it still needs to be
> represented
> as a (call …) rtx in rtl, and emitted using emit_call_insn.
> 
> In other words, the "call" expander must always emit a call_insn
> of some kind.  (But it can emit other instructions too, such as the
> ones you describe above.)
> 
> Richard
> 

Richard,

Thanks for the reply. While what you're saying makes sense, it didn't
solve my problems. The symptoms changed, but didn't completely go away.
At the same time, I realized that - in this architecture - link-
register-style calls are more efficient anyway, so I've changed my call
implementation to that configuration. That got rid of the need for
sloving this particular problem.

So, just to document for people who might be looking at this thread in
the future: this wasn't the complete answer to my problem, but I took a
different route which removed the whole problem class.

Thanks again,
Andras




      reply	other threads:[~2022-01-20 23:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19  4:53 Andras Tantos
2022-01-19 10:45 ` Richard Sandiford
2022-01-20 23:47   ` Andras Tantos [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=68513876d24698f479260a083443f999a8b50fc7.camel@tantosonline.com \
    --to=andras@tantosonline.com \
    --cc=gcc@gcc.gnu.org \
    --cc=richard.sandiford@arm.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).