[net.arch] 16032 code generation

gnu@sun.uucp (John Gilmore) (06/27/85)

Paul Vixie, {pyramid,dual,decwrl}!greipa!paul, said:
> The above code is not very pretty nor efficient.  In each case I have done
> five operations:  move, multiply, add, add, move.  The only real difference
> is in the addressing modes;  this seems common of compiler-generated code.

Funny, I noticed a lot of differences in the opcodes too.  Could it
be that the compilers are not using the instruction set orthagonally
because you can produce better code if you use a few special cases (e.g.
"index"), or because the machine doesn't exactly implement the language
(e.g. sign-extension instructions need to be added)?  In both cases,
the argument that the compiler can be simple has broken down.

> I don't remember an external or frame-relative addressing mode;  one assumes
> that the many otherwise useless address registers will be used to hold the
> current global and frame pointers, and the loader has alot of fixing up to
> do on those globals - every reference needs modification, not just an extern
> table (unless you plan to have your compiler generate enough low-level stuff
> to do what the 32xxx external addressing mode does automagically).

Typical 68000 loaders&compilers generate code just like for most other
machines (eg pdp11, vax, 360, ...) and do "alot of fixing up" -- at
link time, rather than at execution time.  (When you buy Unix, even the
Bell versions, it already knows how to do this.)  The 16032 lets you do
it either way, but it costs a lot of cycles to do it at run time.  The
68000 requires careful compilers generating extra instructions to do
runtime linking efficiently.  The new expensive 68020 addressing modes
let you simulate the 16032's expensive external modes if you really want.

peterb@pbear.UUCP (06/29/85)

	Well I know that on my little PC/IX system, "binding" is done for
some of the libraries. This will link the code together and leave the
unresolved for later. This is possible since all jumps anc calls are
pc-relative. Globals/externs are the only tags classes that can no be
resolved at that time. It sure does speed link time...

	Peter Barada
	{ihnp4!inmet|{harvard|cca}!ima}!pbear!peterb

Ps - The 8086 small model is a snap to produce fast code for, all you have
to do is keep in mind what registers are usable for indexinc, and work
around the special caseds for mul/div. The rest is pretty straight forward.
In fact I am working on a small model pascalish language that can nest
procecedures and functions, and the code generation is very straight
forward. I will post times for c/pl0 comparisons at a later date.