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 sell...@imgtec.com