This is the mail archive of the
mailing list for the GCC project.
Re: scavanging a reg
[Get raw message]
- To: Aldy Hernandez <aldyh at redhat dot com>
- Subject: Re: scavanging a reg
- From: law at redhat dot com
- Date: Tue, 13 Nov 2001 12:50:38 -0500
- Cc: David Edelsohn <dje at watson dot ibm dot com>, gcc at gcc dot gnu dot org
- Reply-to: law at redhat dot com
> On Tue, 2001-11-13 at 11:25, firstname.lastname@example.org 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 nee
> > > 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. */
> 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?
Either-or should be OK.