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

Re: [f-cpu] calling conventions



My two cents:

Defining a standard calling convention seems like a good idea to me. One of
the reasons why languages use different conventions may be that no one put
their foot down at the beginning and said you must use these conventions to
be compatible. Heterogenous calling conventions are a big pain.

I think regs should be assigned in the following order

r63: return address    - most RISC machines use last reg for return address
and you are guarenteed to always need a return address, hence this reg
should be fixed like r0. It is probably better to put it at the end since
the remaining pointers are not always needed
r62: stack pointer        - many languages need a stack pointer - its the
next most fixed requirement
r61: global pointer    - likely next most useful pointer
r60: frame pointer    - sometimes used along with stack pointer
r59: base pointer      - pascal

It should be specified that these regs *must* be used as above. If a
language doesn't need a particular register eg frame pointer, then it can
use the register for whatever it wants.

Variable argument lists are a bad idea. I would discourage their use by
making them as slow as possible :). Most languages don't support them and
this is the trend.

Rob


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