Re: Invalid registers

Andrew STUBBS
2005-07-13T16:16:40Z

On Wed, 13 Jul 2005 16:42:07 +0100, Daniel Jacobowitz <drow@false.org>
wrote:

> On Wed, Jul 13, 2005 at 03:44:10PM +0100, Andrew STUBBS wrote:
>> With this function I get different wrong behaviour. Now I get all but PC
>> and R15 (stack pointer) as '*value not available*'. I had expected that
>> that the CFI would override the initialised values because it knows best
>> (just because it is called 'init', not 'set), but neither R14 nor PR
>> have
>> their true values listed despite execute_cfa_program extracting a 'how'
>> value of DWARF2_FRAME_REG_SAVED_OFFSET. Clearly this is not the case,
>> but
>> should it be?
>
> Why isn't it? Please debug this, since reading the code clearly
> suggests it works as you expect. See dwarf2_frame_cache.

I'll see what I can find.

>> I know the PR register is
>> technically caller save, but has a CFI entry in my test program, but
>> then
>> in practice PR is really treated as callee save anyway. Is that just a
>> special case?
>
> I would need to see the CFI, sorry - I can't follow exactly what you
> mean.

The SH ABI lists the PR register (in which the PC is saved by a branch to
subroutine) as caller save. This is true because a function has to save it
before calling a subroutine. However, in practice it can be viewed as a
callee save register because all non-leaf functions save it in the
function prologue. GCC appears to be emitting CFI information for PR as if
it was callee save.

You say that there should be no CFI for caller saved registers, so I'll
take that as answering my question.

Thanks

Andrew Stubbs