[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [f-cpu] calling conventions



> > > personally, I'm wondering if it is really necessary to limit function
> > > argument to r15 instead of r31 or r29 (to be sure to have at least a pair
of
> > > temporary registers), in so far as we can consider that all function
> > > arguments not used by a function may be used as temporary registers by
this
> > > function...
> I am currently asking the same question with a little variation, why
> not putting in r31 the pointer to parameter allocated stack.
>

Yes but still we should not start from r1 but r2 (that is with an even number)
for function arguments or return values. So what would be the use of r1, number
of registers allocated as arguments ? don't forget about the fact if you use
your OPCODE where you need to use or compute a pair (Rn,Rn^1), you couln't use
r1, instead of r0 which is hardwired to 0.

And r31 is an odd number so you wouldn't have an even pair of registers.

By the way, take this example :

int f ((r2) a, (r3) b, (r4) c, (r1 *)...) { ... }

variable arguments are pushed via, say, register sp (that is the register Rn
which always points on top of stack), if you copy the value of sp before
pushing variable arguments in r1, you got the number of variable registers
pushed that way : sp - r1. Unless you really want to have the whole number of
registers used by this function (but even so you cannot say if one is in
register or in stack). So I'm not sure it is really important to have an
implicit register for number of function arguments (we still don't know where
in the register set or stack to fing the arguments).

Well, I think it is surely too early to debate on that kind of topic, it mainly
depends on compiler not on cpu hardware.




*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/