Got the svm1 back end to assemble... something.
No disassembler yet. Added lapgen rules until it compiled the whole
system.
* src/Makefile.in (microcode/svm1-defns.h): Detect changes to machine
definition and re-compile it, BEFORE compile-microcode.
(subdir-list): New. Cough up SUBDIRS.
* src/Stage.sh: New. Uses `make subdir-list' to get SUBDIRS from the
Makefile, allowing this script to be invoked with arguments, via
shell command line, not make.
* src/compiler/Clean.sh: Added make.bin to the remove list.
* src/compiler/Stage.sh, src/etc/Stage.sh (make-cross): This new Stage
command stashes compilation AND cross-compilation products.
* src/compiler/machines/svm/assembler-compiler.scm: Added rule-matcher
anti-syntax, so that assembler-runtime.scm can be loaded.
* src/compiler/machines/svm/assembler-rules.scm: Changed the offset
addressing mode to take signed 8 and 16 bit offsets.
* src/compiler/machines/svm/assembler-runtime.scm: Added variable-width
instruction encoders to the fixed-width encoders of the machine
description.
Punted symbolic-expressions. All such are now passed up to the assembler
top-level.
(match-pattern): Get the list of values leftmost-first.
(register-reference?): Punt these redundant definitions. Register
references are now part of machine.scm.
(any-register?, word-register?, float-register?): Not used.
(word-register-reference?, float-register-reference?): Use the register
reference munging procedures.
(encode-rref): The machine expects float register numbers to start with 0.
* src/compiler/machines/svm/compile-assembler.scm: Load assembler-compiler
before assembler-runtime.
* src/compiler/machines/svm/compiler.pkg: Import instructions;
add-instruction! is not sufficient for this assembler. And the register
reference procedures are now in scope via the (compiler) package.
* src/compiler/machines/svm/lapgen.scm: Punt environment register. Move
register reference procedures to machine.scm.
Fixed applications of inst:copy.
Use BLOCK-OFFSET directives in external labels.
Move evaluation of parse-memory-address rule bodies into lapgen rule
bodies, where procedures like word-source can gen. LAP.
* src/compiler/machines/svm/machine.scm: Added a new fixed register -- the
interpreter-register-block -- for easy access to the interpreter's
interrupt-mask, lexpr-actuals, etc. Punted the environment register, now
accessible via interpreter-register-block.
(define-generic-unary-operations, define-generic-binary-operations):
Punted. These instructions do not need type parameters. Added them to the
corresponding define-bi/unary-operations lists.
(load-immediate-operand?): Typo.
(ea:environment, ea:lexpr-actuals): New, using the new interpreter-
register-block register.
Fixed the other ea: procedures to use register references, not numbers.
(define-traps): Allow the C-friendly synonyms to be specified. Provide the
necessary synonyms for +, -, *, /, 1+, -1+, =, < and >. Punt non-existent
traps: the lookup-apply, conditionally-serialize and *-trap traps. The
reference-trap trap is actually the lookup trap. The unassigned?-trap trap
is actually the unassigned? trap. Etc.
(register-reference, register-reference?, etc.): Create the fixed registers
and register references from one list. Provide the register reference
procedures here, for the (compiler assembler) and (compiler lap-syntaxer)
packages, AND assembler-compiler.
* src/compiler/machines/svm/make.scm: Initialize the assembler instructions.
* src/compiler/machines/svm/rules.scm: Get the right type of target/source
for inst:load/store.
Fixed applications of inst:copy, inst:increment.
Expect a thunk from parse-memory-address.
There is no single-arg predicate LT, but there is an SLT.
(OVERFLOW-TEST): Without a register argument (or implicit condition
register) fixnum methods must test for overflow.
Added a few rules to recognize float constants being loaded into registers,
used as the second arg. in flonum-pred-2-args instructions, or as an
argument to flonum-1/2-arg instructions.
Get the correct type of register for flonum instructions.
(INVOCATION:CACHE-REFERENCE): Punt fixed registers. Use the extension
register if possible, and temporaries for the rest.
(INVOCATION:LOOKUP): No such utility, and the lookup-apply trap is no more.
(INVOCATION:PRIMITIVE): trap:primitive-lexpr-apply takes just one arg.
Store the arg count in the interpreter's lexpr-actuals register.
(move-frame-up): Compare registers (numbers), not references. The arg is a
reference.
inst:load-pointer does not take an address, just a register.
(generate/closure-header): Don't skip the external/internal equate when
nentries is zero.
(generate/quotation-header, generate/remote-link): Rename registers to
indicate usage.
(generate/remote-links): Keep the interpreter's environment in a temporary
register.
Typos.
Punted several rewrite rules that replace registers with their known
values. This is useless here, where instructions like + and load-pointer
only take register operands.
* src/etc/compile-svm.sh: Re-written to do a proper cross-compilation, with
host-compiled cross-compiler. Swaps host and cross compiler products
in/out of stages X and 0, respectively. Thus a rebuild does not have to
recompile much, not even the previously cross-compiled files.
* src/etc/create-makefiles.sh, src/microcode/makegen/makeinit.sh: Use
--batch-mode.
* src/etc/functions.sh (run_cmd_in_dir): Echo dir name as well as command
line.
(maybe_mv): New. Punts moving e.g. *.moc if there are none.
* src/microcode/svm1-defns.h: New machine definition. See changes to
assembler-rules.scm and machine.scm.
* src/microcode/svm1-interp.c (initialize_svm1): Initialize new fixed
register interpreter-register-block. Fix initialization of the float
registers.
Added new offset address decoders.
20 files changed: