Boolean Operators Slighted in C (Really arguments in registers)

Wendy Thrash wendyt at pyramid.UUCP
Fri May 9 04:30:20 AEST 1986


WARNING:  This article discusses compiler issues, not specifically C
language issues.

In article <268 at valid.UUCP> sbs at valid.UUCP (Steven Brian McKechnie Sargent) writes:
>*	Arguments passed in registers...
>... have the same effect of reducing simplicity for doubtful gain.

I don't want to quote too much of the original article -- it was rather long.
The thrust of it was that passing parameters in registers doesn't make things
run faster.  This does not fit with my experience.  When we implemented
parameter passing in registers at Zilog, it was a big win.

The argument that register variables must be pushed on the stack in order
to pass parameters in registers seems tenuous.  If you have only one set
of registers available for variables, you have to save them sometime,
unless the routine you are calling has no register variables itself.  More
commonly, registers used for parameter passing are not used for register
variables; they may be used for temporaries.  It is true that this may cut
down on the number of available registers, but our work showed that we had
enough registers remaining to allow good code generation for most programs.

We did, indeed, allow the callee to use its arguments in place. Mr. Sargent's
statements about "spaghetti code" make no sense at all to me -- this was
a COMPILER;  it was designed to produce efficient assembly language, not
readable assembly language.  When the compiler functioned correctly (as it
usually did) there were no "attendant side effects and untraceable bugs."

I will admit that this parameter passing caused difficulties.  In particular,
varargs code was messy, and debuggers more difficult to implement.  Was it
worth it?  I believe so.  Our emphasis was on speed, and that we had.

Of course, this is all moot on RISC machines with sliding register windows.
The concept of parameter passing in registers is then wired into the
architecture, and there are plenty of registers left for register variables.

---
Disclaimer:  My opinions have obviously been influenced by the parameter
passing in registers of my former employer (Zilog) and the sliding windows
of my current employer (Pyramid).
-- 
Wendy Thrash   {allegra,cmcl2,decwrl,hplabs,topaz,ut-sally}!pyramid!wendyt
Pyramid Technology Corp, Mountain View, CA  +1 415 965 7200 ext. 3001



More information about the Comp.lang.c mailing list