Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED

Alan Modra alan@linuxcare.com.au
Tue, 16 Jan 2001 10:17:52 +1100 (EST)


On Mon, 15 Jan 2001, John David Anglin wrote:

> The effect of these rules is that gp must be treated as a scratch register
> at a point of call but a procedure must preserve it from entry to exit.

Interestingly, gcc currently does not always preserve gp.

extern void foo (void);
int main (void) { foo(); return 0; }

compiled with -O gives

        std %r2,-16(%r30)
        ldo 128(%r30),%r30
        std %r3,-128(%r30)
        copy %r27,%r3
        b,l __main,%r2
        ldo -16(%r30),%r29
        copy %r3,%r27
        b,l foo,%r2
        ldo -16(%r30),%r29
        ldi 0,%r28
        ldd -144(%r30),%r2
        bve (%r2)
        ldd,mb -128(%r30),%r3

and gp is not restored after the call to foo.

-- 
Linuxcare.  Support for the Revolution.