This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch for dwarf2 EH on ARM



jason@cygnus.com said:
> I had an interesting time tracking down some of the problems with this
> port.  Why do we use a callee-saved register for the static chain on
> ARM? 

Probably because it's broken.

The fundamental problem is that the only registers that are not 
callee-saved are r0-r3, r12 (ip) and r14 (lr).  r0-r3 contain arguments 
and r12 is often needed as a scratch in the prologue (worse still, r12 is 
almost unusable in Thumb mode because it is a high register).  Finally, 
r14 contains the return address, so can't be used for the static chain 
either.

Rewriting the prologue code to avoid use of r12 is possible, but makes the 
prologue significantly less efficient, so we wouldn't want to do it in 
general.  Finally, there are variants of the APCS that use r12 for passing 
the static base around when compiling for PIC (though gcc doesn't 
currently support these variants, and may never do).  I'm not sure what 
the new ATPCS says about use of r12; I'll have to check.

R.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]