This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question about DRAP register and reserving hard registers
- From: Steve Ellcey <sellcey at imgtec dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Fri, 19 Jun 2015 09:42:19 -0700
- Subject: Re: Question about DRAP register and reserving hard registers
- Authentication-results: sourceware.org; auth=none
- References: <163e6dcd-b157-47a1-aed3-01eb1b287851 at BAMAIL02 dot ba dot imgtec dot org> <5584148A dot 7040602 at redhat dot com>
- Reply-to: <sellcey at imgtec dot com>
On Fri, 2015-06-19 at 09:09 -0400, Richard Henderson wrote:
> On 06/16/2015 07:05 PM, Steve Ellcey wrote:
> >
> > I have a question about the DRAP register (used for dynamic stack alignment)
> > and about reserving/using hard registers in general. I am trying to understand
> > where, if a drap register is allocated, GCC is told not to use it during
> > general register allocation. There must be some code somewhere for this
> > but I cannot find it.
>
> There isn't. Because the vDRAP register is a pseudo. The DRAP register is
> only live from somewhere in the middle of the prologue to the end of the prologue.
>
> See ix86_get_drap_rtx, wherein we coordinate with the to-be-generated prologue
> (crtl->drap_reg), allocate the pseudo, and emit the hard-reg-to-pseudo copy at
> entry_of_function.
>
>
> r~
OK, that makes more sense now. In my work on MIPS I was trying to cut
out some of the complexity of the x86 implementation and just use a hard
register as my DRAP register. One of the issues I ran into, and perhaps
the one that caused x86 to use a virtual register, was saving and
restoring the register during setjmp/longjmp and C++ exception handling
usage. I will trying switching to a virtual register and see if that
works better.
Other than exceptions, the main complexity in dynamic stack alignment
seems to involve the debug information. I am still trying to understand
the handling of the drap register and dynamic stack alignment in
dwarf2out.c and dwarf2cfi.c.
Steve Ellcey
sellcey@imgtec.com