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]
Other format: [Raw text]

Previously applied patch- force PR to be live, causes problem in gcc-3.0.2 for SH target


The following patch is causing the problem decribed below.

* sh.c (initial_elimination_offset): When seeing
 RETURN_ADDRESS_POINTER_REGNUM, force pr to be live.
http://gcc.gnu.org/ml/gcc-cvs/2001-09/msg00359.html

This causes the PR to be saved on stack and restored even though there is
no function call from within a function. So if there is a function
hardware_initialize
which has memory initialization in it, called from a assembly file,as it
stores the PR
on to stack and stack is not yet available it causes an error.
e.g. for the following small program and generated assembly code is :
extern void hardware_initialize(void);
void prtest(void)
{
        // hardware_initialize();
}
Assembly -
        .file   "prtest.c"
        .text
        .align 2
        .global _prtest
        .type   _prtest,@function
_prtest:
        mov.l   r14,@-r15
        sts.l   pr,@-r15
        mov     r15,r14
        mov     r14,r15
        lds.l   @r15+,pr
        mov.l   @r15+,r14
        rts
        nop
.Lfe1:
        .size   _prtest,.Lfe1-_prtest
        .ident  "GCC: (GNU) 3.0.2"

As this feature was not there in gcc-3.0.1 it works fine for the c function
called from assembly.

Is there any specific reason for saving and restoring PR to/from stack? Or
could it be reversed?
Any help will be appreciated.
Regards,
Anita Kulkarni


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 Free download and free European support of GNU tool 
     chain (GNUSH v0101) for Hitachi's SH Series 
Read more at http://www.kpit.com/products/support.htm 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  



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