public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: law@redhat.com, David Edelsohn <dje@watson.ibm.com>
Cc: gcc@gcc.gnu.org
Subject: Re: scavanging a reg
Date: Thu, 01 Nov 2001 23:50:00 -0000	[thread overview]
Message-ID: <1005669721.23202.254.camel@litecycle.cc.andrews.edu> (raw)
In-Reply-To: <28174.1005668752@porcupine.cygnus.com>

On Tue, 2001-11-13 at 11:25, law@redhat.com wrote:
>   > i need a GPR at epilogue/prologue time so i can load and save to the
>   > VRSAVE register (which can only be moved to and fro GPRs).
>   > 
>   > what's the best route for this?  can i iterate through "regs_ever_live"
>   > and get one from there?  i mean, reload is already done so we won't need
>   > any more registers.
> True, but you also can't make a call-saved register live that wasn't live
> before.  So you have to find a call-clobbered register.  

doh.. i thought about that right after i sent the mail...

how about this?

    /* Scavange any non fixed register we can use as scratch at
       pro/epilogue time.  Pick a register out of the call clobbered set
       because no one expects it to hold anything meaningful.  */
    
    int
    get_scratch_gpr (void)
    {
      int i;
    
      for (i = GP_ARG_MAX + 1; i <= 32; ++i)
        if (! fixed_regs[i] && call_used_regs[i])
          return i;
    
      /* If	we can't find anything,	return	r12.  */
      return 12;
    }
    
although i'm thinking it's prob best to follow David's suggestion and
just use r12 regardless.

is the above ok?

-- 
Aldy Hernandez			E-mail: aldyh@redhat.com
Professional Gypsy
Red Hat, Inc.

  reply	other threads:[~2001-11-13 16:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-01 21:49 Aldy Hernandez
2001-11-01 22:41 ` law
2001-11-01 23:50   ` Aldy Hernandez [this message]
2001-11-02  6:43     ` law
2001-11-02  6:46     ` David Edelsohn
2001-11-02 13:38     ` Richard Henderson
2001-11-01 23:27 ` David Edelsohn

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=1005669721.23202.254.camel@litecycle.cc.andrews.edu \
    --to=aldyh@redhat.com \
    --cc=dje@watson.ibm.com \
    --cc=gcc@gcc.gnu.org \
    --cc=law@redhat.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).