Got the (incomplete) svm1 back end complete enough to generate LAP.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Sat, 20 Mar 2010 20:45:04 +0000 (13:45 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Sat, 20 Mar 2010 20:45:04 +0000 (13:45 -0700)
commit08f05ab7693fb7795231bb1c1f5288edeb55418f
treeae4ebb3a5bc56d5200f36cffeb902869f85bb1d7
parentf67143776c5448fe515d85a6a328c7d8d760e009
Got the (incomplete) svm1 back end complete enough to generate LAP.

* src/Makefile.in (all-svm): New target, analogous to all-liarc.

* src/compiler/configure: Added make.bin to LINKS, so a purely
interpreted compiler can be loaded.

* src/compiler/machines/svm/assembler-compiler.scm
(write-copyright+license):  Punted.

(rt-defn-decoder-constructor): Removed leftover references to
coding-type, which became an implicit rt-coding-type parameter.

* src/compiler/machines/svm/assembler-runtime.scm
(init-assembler-instructions!): New skeleton.  Error actions.

(make-symbol-table): Renamed "make-typed-symbol-table", to keep it
distinct from back/symtab.scm's "symbol-table", which is used by the
assembler top-level (back/bittop.scm, back/bitutl.scm).

(Assembler Machine Dependencies): New.  Just the required (per CREF
analysis) bindings, pilfered from i386/assmd.scm.

(Instructions, Memory addressing, Traps, Machine registers): Removed
to machine.scm.

(Register references): Removed to lapgen.scm, except
word-register-reference? and float-register-reference?.  Then had to
copy register-reference?, and import register-reference AND
reference->register.

(Symbolic addresses): Commented out for now.

* src/compiler/machines/svm/compile-assembler.scm: Punt loading
write-mit-scheme-copyright from ../../../runtime/version, and the
commented out LAP macrology.

* src/compiler/machines/svm/compiler.pkg (compiler lap-syntaxer):
Include CREF, for decls.scm.  Moved assembler-runtime.scm,
assembler-db.scm, and svm1-opcodes.scm to (compiler assembler).

(compiler assembler): Added back/symtab.scm to complete the
machine-independent assembler top-level.  Import from (compiler
lap-syntaxer) some of the register-reference procedures that just
moved to lapgen.scm.  Import add-instruction!.

* src/compiler/machines/svm/compiler.sf: Load option SF.  This file is
intended to run in a band withOUT an existing (compiler) package.

* src/compiler/machines/svm/decls.scm (init-packages): No longer used.

(setup-source-nodes! env): Typo.

* src/compiler/machines/svm/disassembler.scm: For now a no-op.
Deleted the code copied verbatim from i386/dassm1.scm.

* src/compiler/machines/svm/lapgen.scm (available-machine-registers):
New.

(Register references): New from assembler-runtime.
(register-reference): Fixed to include the
un-available-machine-registers.

(rref:word-0, etc.): New.

(make-internal-procedure-label): Fixed to use new
encode-internal-procedure-offset.
(encode-internal-procedure-offset): New.  Copied from
encode-continuation-offset.

(invert-condition): Make conditions a proper alist.

(interpreter-call-argument?, interpreter-call-temporary)
(rtl:simple-offset?, simple-offset->ea!): New from i386, like
interpreter-call-argument->machine-register!, BUT uses
prefix-instructions!, if necessary, and a temporary which, with Good
Luck, will use the same alias as the argument.

(parse-memory-address): Fixed to avoid thinking (un-thunking?) #f.

* src/compiler/machines/svm/lapopt.scm (optimize-linear-lap): Now a
no-op.  Deleted the code copied verbatim from i386/lapopt, i.e. all of
it.

* src/compiler/machines/svm/machine.scm (Architecture Parameters):
Needed endianness, scheme-datum-width, and some *-fixnum/*-limit
bindings.

(Instructions, Memory addressing, Traps, Machine registers): New from
assembler-runtime.scm.  This makes the regnum:*, inst:*, trap:* and
ea:* bindings available to (compiler lap-syntaxer) AND (compiler
lap-optimizer), assuming the latter eventually wants to generate some
LAP, as in other back-ends.

(interpreter-register:environment, etc.): New from i386.

(define-machine-register): Closing the syntactic environment around
e.g., interpreter-value-register, causes it to be renamed.  Generate
defines with bare symbols for binding names.

(interpreter-regs-pointer?, interpreter-regs-pointer): New.  No-ops.

(rtl:machine-register?): Map ALL registers, including dynamic-link,
environment, and all of the interpreter-call-result: registers.

(Closure format): Added a closure-entry-size binding, as in other
architectures, a reflection of CLOSURE_ENTRY_SIZE in
microcode/cmpintmd/svm1.h.

* src/compiler/machines/svm/make.scm: New.  Cribbed from i386.

* src/compiler/machines/svm/rgspcm.scm: Typo.

* src/compiler/machines/svm/rules.scm: Fixed some typos, e.g. source
vs. target, trap:[compiler-]lexpr-apply, etc.  Added a few rules for
CONSTANTs and CONS-POINTERs.  Expect just an effective address from
parse-memory-address.

(interrupt-check): Punted, along with shared closure interrupt code.
simple-procedure-header only needs to generate an interrupt-test-*
instruction.

(generate/cons-closure, generate/cons-multi-closure): Replaced the old
i386 code.

(generate/closure-header): Replaced the old i386 code.  Use
simple-procedure-header.

(generate/make-magic-closure-constant, make-closure-longword)
(make-closure-code-longword): Punted.  Compiled closure entries do not
even have a format word!

(CONS-MULTICLOSURE, generate/quotation-header, generate/remote-link)
(generate/remote-links): Replaced the old i386 code.

(generate/constants-block): Finished skeletal code.

(INTERPRETER-CALL:): Provide interpreter-call-temporary argument to
the trap:* instructions.

(integer-power-of-2?): Added, for FIXNUM-2-ARGS.

* src/configure.ac (ALL_TARGET): Set to "all-svm".

* src/etc/compile-svm.sh: New.

* src/microcode/cmpintmd/svm1.c, svm1.h: Extern read_u16, for
svm1-interp.

* src/microcode/option.c (add_to_library_path, quote_string)
(strlen_after_quoting, must_quote_char_p): Removed.  No longer in use.

* src/microcode/svm1-interp.c (enter_closure): Use CLOSURE_COUNT_SIZE,
CLOSURE_ENTRY_SIZE, skip_compiled_closure_padding and read_u16.  This
makes enter_closure look like the other closure handling procedures in
cmpintmd/svm1.c.
21 files changed:
src/Makefile.in
src/compiler/configure
src/compiler/machines/svm/assembler-compiler.scm
src/compiler/machines/svm/assembler-runtime.scm
src/compiler/machines/svm/compile-assembler.scm
src/compiler/machines/svm/compiler.pkg
src/compiler/machines/svm/compiler.sf
src/compiler/machines/svm/decls.scm
src/compiler/machines/svm/disassembler.scm [new file with mode: 0644]
src/compiler/machines/svm/lapgen.scm
src/compiler/machines/svm/lapopt.scm
src/compiler/machines/svm/machine.scm
src/compiler/machines/svm/make.scm [new file with mode: 0644]
src/compiler/machines/svm/rgspcm.scm
src/compiler/machines/svm/rules.scm
src/configure.ac
src/etc/compile-svm.sh [new file with mode: 0755]
src/microcode/cmpintmd/svm1.c
src/microcode/cmpintmd/svm1.h
src/microcode/option.c
src/microcode/svm1-interp.c