home .. forth .. misc mail list archive ..

Function arguments in registers


At 09:24 AM 3/21/96 EST, John Strohm wrote:
>>I'm still wondering how current RISC processors that
>>have only a limited number of registers in which they try
>>to convey the function arguments, do this when there
>>is an unknown number of arguments, like in printf().
>
>The standard technique is to pass the first "k" number of arguments, where
>k is some small positive integer chosen by the compiler writer, in
>registers and push the rest directly onto the stack.  In the case of
>brain-dead languages like C, the programmer is responsible for determining
>how many arguments were in fact passed and using only that many.  In other
>languages, the compiler writer will have defined a calling protocol that
>will (USUALLY) tell the called routine how many arguments were passed.

Yes, but how will you translate existing C-programs efficiently?
As I said in another message: The Am29000 didn't conform and died...

Operating systems and a lot of other serious programs are written in C
and other conventional languages like Pascal, Algol (Cobol, Fortran ....).

What about using structures as arguments?
Will the structure be separated between registers and memory?

Professor van der Poel used to say: Always provide zero, one or
infinite instances of any resource.

Groeten,
Jaap

-- Chip Directory
-- http://www.hitex.com/chipdir/ - USA
-- http://www.xs4all.nl/~ganswijk/chipdir/ - Europe
-- Many other international mirror sites from there...