[net.lang] Aztec C

aglew@ccvaxa.UUCP (08/17/86)

... > Consulair C being disparaged for its calling convention, which
... > has the callER save/restore registers, instead of the callED
... > routine...

I have no experience with Consulair C, and in fact have not worked on 
micros (except for hacking) for almost a year now, but Consulair's 
calling convention sounds like one of the most advanced in micros, one
that I know several performance oriented mini, supermini, and Crayette
manufacturers are using and considering.

Isn't it obvious that having the callER save only the registers that he
needs is more efficient than having the callEE save all the registers that
might be modified (which, for reasonably sized routines, becomes all of
them)? Maybe not if it requires one instruction per register, but certainly
if you have a block register save/restore instruction, especially under
mask.

If you look at the problem, you see that there are three sets of registers
that might be saved:
    (1) All the registers the callER needs preserved
    (2) All the registers the callEE might clobber
    (3) the intersection of (1) and (2).
Most micros implement (2). Consulair implements (1). If it generates good
code, (1) is nearly always smaller than (2), because the compiler can arrange
for registers to be saved as side-effects (well, actually by using add to
memory instead of to register, but anyway...). (3) would be best of all,
but the most straightforward implementation militates against separate
compilation, whereas the dynamic implementation, with a register use mask,
usually uses up too many instructions to manipulate the mask on machines
not designed to that purpose.

Lang and Huguet, in "Reduced Register Saving/Restoring in Single-Window
Register Files", _Computer_ _Architecture_ _News_, Vol 14 No 3 June 1986,
describe these schemes as well as a few variations (save only when used,
restore only when needed), and report that with one of the proposed schemes
traffic is reduced by 86% wrt. conventional callEE save/restoring.
Admittedly this was done on PCC, which isn't exactly an advanced compiler,
but the results are still impressive.

Consulair sounds much less impressive in its use of register variables. Too
bad.

By the way, if you want parameters passed on the stack instead of in
registers, you are going to have trouble with the next generation of
microprocessors.