This is the mail archive of the gcc@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]

Preserve registers across function call (Re: CALL_USED_REGISTERS)


  My name is Makoto Fujiwara, I am working a particular port
for private CPU (at the time being). The porting itself is
getting very well, I believe, say having more than 30,000 PASS
with testsuite. Although no execution available for that make check,
I am preparing gdb/sim based execution verification with separate
make check.

My question is: 

The (gccint) info says, 
-----------
If a register has 0 in `CALL_USED_REGISTERS',
 the compiler automatically saves it on function entry and
restores it on function exit, if the register is used within 
the function.
-----------
in the context attatched. ( I believe this info is with gcc-4.2.1)

But unfortunately, my port does not seem to work as described
above (no preserve code found at *.s output).  The port is
based on 4.2.1 for the moment. I know either cpu.h or cpu.md is 
wrong, but to trace the problem,

Could anyone suggest me which part of the src is taking care
of above save/restore processing ?  
  calls.c 
  function.c  -> expand_function_{start,end}()
  caller-save.c  -> save_call_clobbered_regs()
  reload1.c 
  or others ?
I believe it should be in function.c, but I can not figure out
which lines (function) to take care those things.
(or the explanation in info is obsolete ?)

Thanks in advance,
---
Makoto Fujiwara, 
Chiba, Japan, Narita Airport and Disneyland prefecture.

(attachment)
15.7.1 Basic Characteristics of Registers
-----------------------------------------

Registers have various characteristics.

 -- Macro: FIRST_PSEUDO_REGISTER
	...
 -- Macro: FIXED_REGISTERS
 	...    
 -- Macro: CALL_USED_REGISTERS
     Like `FIXED_REGISTERS' but has 1 for each register that is
     clobbered (in general) by function calls as well as for fixed
     registers.  This macro therefore identifies the registers that are
     not available for general allocation of values that must live
     across function calls.

     If a register has 0 in `CALL_USED_REGISTERS', the compiler
     automatically saves it on function entry and restores it on
     function exit, if the register is used within the function.


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