[net.micro.16k] 16032 Calling Sequence Proposed Standard

thomson@utcsrgv.UUCP (Brian Thomson) (06/21/83)

Ten days ago we submitted an article that wondered aloud 'what is
the right calling sequence for a National Semiconductor 16032 C compiler?'
We offered a trade-off:  use slow 'cxp' and produce programs that are
10% smaller AND compatible with National's "preferred" linkage, or use
'jsr' and have your programs run 8% faster.  Most respondents felt that 
compatibility was more important than either size or speed, and that
since National was committed to 'cxp' (or so we thought), that we should
go that way too.

Glenn Skinner of National recently responded in net.micro.16k that
they had not yet decided themselves.  This indicates to us that their
experimentation agrees with ours, and that 'jsr' is (much ?) faster than
'cxp' for a typical UNIX program.

Since there doesn't seem to be a standard to follow, let's re-examine
the technical arguments.

Size vs. speed:  If we are only talking about a single C compiler,
then 'jsr' is the obvious choice.  It is faster, and speed is more important
than size on a micro.  You can always buy more memory, but a faster CPU is
harder to come by.

Modularity:  Module tables and 'cxp' are not necessary for dynamic linkage
or ROM-able code.  Both data and routines can be accessed indirectly using
existing addressing modes (and more efficiently, as Mr. Skinner tells us).

Compatibility:  There are reasons why languages OTHER than C would want to
use 'cxp'.  Pascal, Concurrent Euclid, and Ada share little data between
compilations and would benefit from the shorter and slightly faster
'SB'-based addressing modes that 'cxp' makes possible.  We would like to
be able to call these languages from C.

We need a standard calling sequence on this machine.  We propose the
following:

      1) 'cxp' is the standard calling sequence for user programs,
	subroutine libraries, etc.  'SB' addressing should be
	encouraged.
    
      2) 'jsr' can be used by the operating system kernel, and
	anything else that does not need to use standard libraries.
	'SB' addressing can't be used, but the extra speed should
	make up for this.

The C compiler should have a flag which optionally produces 'jsr' code.
By default, 'cxp' code should be emitted.  In practice, only the operating
system kernel would need to use this flag.

				Brian Thomson,  utcsrgv!thomson
				Dave Galloway,  utcsrgv!drg
				  CSRG Univ. of Toronto