Caller allocates space for callee-save registers

pardo@cs.washington.edu (David Keppel)
Thu, 21 May 1992 18:46:42 GMT

          From comp.compilers

Related articles
Caller allocates space for callee-save registers pardo@cs.washington.edu (1992-05-21)
Re: Caller allocates space for callee-save registers pardo@cs.washington.edu (1992-05-27)
Re: Caller allocates space for callee-save registers gaynor@brushfire.rutgers.edu (1992-05-29)
Re: Caller allocates space for callee-save registers henry@zoo.toronto.edu (1992-05-29)
Re: Caller allocates space for callee-save registers andrew@rentec.com (1992-05-31)
Re: Caller allocates space for callee-save registers juul@diku.dk (1992-06-01)
Re: Caller allocates space for callee-save registers andrew@rentec.com (1992-06-01)
[17 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: pardo@cs.washington.edu (David Keppel)
Keywords: registers, optimize
Organization: Computer Science & Engineering, U. of Washington, Seattle
Date: Thu, 21 May 1992 18:46:42 GMT

The references I have for both the MIPS RX000 (Gerry Kane) and SPARC
(SPARC International) say something to the effect of


The caller's stack frame must have at least N words
the callee can use to save the N argument registers.


On the MIPS, for example, up to 4 arguments can be passed in registers
(a0, a1, a2, a3) and the rest go on the stack. The top 16 bytes of every
stack frame is reserved for spilling a0 through a3.


I'm puzzled: why do these machines have such a convention instead of, say,
requiring the callee to allocate the argument register save area?


I see lots of reasons why the space isn't useful:


  - The argument registers may be clobbered freely by the callee.
  - The caller has no way of telling whether the callee wrote anything
      useful to those slots.
  - Variadic functions could easily allocate contiguous space to clump
      args together in memory w/o copying (free on the MIPS, load/store
      on the SPARC given the current frame convention, free if they'd used
      a different convention).
  - It potentially wastes N*4 bytes in each stack frame.
  - Making use of the space complicates the compiler.
  - If the callee will be spilling registers it will nearly always be
      allocating its own save area/argument build area anyway.


Why is the space allocated there? Please e-mail me the answer, I will
summarize.


;-D oN ( Register slave area ) Pardo
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.