From: Chris Hanson Date: Mon, 17 Jun 1991 21:22:05 +0000 (+0000) Subject: Changes to get compiler running on big-endian MIPS. X-Git-Tag: 20090517-FFI~10510 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=6110bf72e96a946453d777110efc7fc6ec4b9f6f;p=mit-scheme.git Changes to get compiler running on big-endian MIPS. --- diff --git a/v7/src/compiler/machines/mips/assmd.scm b/v7/src/compiler/machines/mips/assmd.scm index c6cae393d..f5b55dffc 100644 --- a/v7/src/compiler/machines/mips/assmd.scm +++ b/v7/src/compiler/machines/mips/assmd.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/assmd.scm,v 1.1 1990/05/07 04:10:19 jinx Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/assmd.scm,v 1.2 1991/06/17 21:20:45 cph Exp $ $MC68020-Header: assmd.scm,v 1.36 89/08/28 18:33:33 GMT cph Exp $ Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology @@ -78,17 +78,25 @@ MIT in each case. |# ;;; Machine dependent instruction order -(define-integrable (instruction-initial-position block) - block ; ignored - 0) +(define (instruction-initial-position block) + (if (eq? endianness 'LITTLE) + 0 + (bit-string-length block))) (define (instruction-insert! bits block position receiver) (let ((l (bit-string-length bits))) - (bit-substring-move-right! bits 0 l block position) - (receiver (+ position l)))) - -(define-integrable instruction-append - bit-string-append) + (if (eq? endianness 'LITTLE) + (begin + (bit-substring-move-right! bits 0 l block position) + (receiver (+ position l))) + (let ((new-position (- position l))) + (bit-substring-move-right! bits 0 l block new-position) + (receiver new-position))))) + +(define (instruction-append x y) + (if (eq? endianness 'LITTLE) + (bit-string-append x y) + (bit-string-append-reversed x y))) ;;; end let-syntax ) \ No newline at end of file diff --git a/v7/src/compiler/machines/mips/compiler.pkg b/v7/src/compiler/machines/mips/compiler.pkg index f84069487..dfd6871d4 100644 --- a/v7/src/compiler/machines/mips/compiler.pkg +++ b/v7/src/compiler/machines/mips/compiler.pkg @@ -1,9 +1,9 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/compiler.pkg,v 1.2 1990/07/22 20:16:15 jinx Rel $ -$MC68020-Header: comp.pkg,v 1.30 90/05/03 15:16:59 GMT jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/compiler.pkg,v 1.3 1991/06/17 21:20:50 cph Exp $ +$MC68020-Header: /scheme/compiler/bobcat/RCS/comp.pkg,v 1.32 1991/05/06 23:09:24 jinx Exp $ -Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology +Copyright (c) 1988-91 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -90,6 +90,7 @@ MIT in each case. |# compiler:generate-rtl-files? compiler:generate-type-checks? compiler:implicit-self-static? + compiler:intersperse-rtl-in-lap? compiler:noisy? compiler:open-code-flonum-checks? compiler:open-code-primitives? @@ -157,6 +158,7 @@ MIT in each case. |# cf compile-bin-file compile-procedure + compile-scode compiler:reset! cross-compile-bin-file cross-compile-bin-file-end) @@ -602,6 +604,8 @@ MIT in each case. |# (export (compiler top-level) *interned-assignments* *interned-constants* + *interned-global-links* + *interned-static-variables* *interned-uuo-links* *interned-variables* *next-constant* diff --git a/v7/src/compiler/machines/mips/dassm2.scm b/v7/src/compiler/machines/mips/dassm2.scm index 1a6c40899..34165557e 100644 --- a/v7/src/compiler/machines/mips/dassm2.scm +++ b/v7/src/compiler/machines/mips/dassm2.scm @@ -1,9 +1,9 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/dassm2.scm,v 1.1 1990/05/07 04:12:17 jinx Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/dassm2.scm,v 1.2 1991/06/17 21:20:56 cph Exp $ $MC68020-Header: dassm2.scm,v 4.16 89/12/11 06:16:42 GMT cph Exp $ -Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology +Copyright (c) 1988-91 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -194,18 +194,24 @@ MIT in each case. |# (let ((contents (read-bits (- offset 2) 16))) (if (bit-string-clear! contents 0) (let ((offset - (- offset (* 2 (bit-string->unsigned-integer contents))))) + (- offset + (* 2 (bit-string->unsigned-integer contents))))) (and (positive? offset) (loop offset))) - (= offset (* 2 (bit-string->unsigned-integer contents))))))))) + (= offset + (* 2 (bit-string->unsigned-integer contents))))))))) (define (make-word bit-string) `(UWORD ,(bit-string->unsigned-integer bit-string))) (define (make-external-label bit-string) - `(EXTERNAL-LABEL - (FORMAT ,(extract bit-string 0 16)) - (@PCO ,(* 4 (extract-signed bit-string 16 32))))) + (if (eq? endianness 'LITTLE) + `(EXTERNAL-LABEL + (FORMAT ,(extract bit-string 0 16)) + (@PCO ,(* 2 (extract bit-string 16 32)))) + `(EXTERNAL-LABEL + (FORMAT ,(extract bit-string 16 32)) + (@PCO ,(* 2 (extract bit-string 0 16)))))) #| ;;; 68k version @@ -242,5 +248,4 @@ MIT in each case. |# (define (invalid-instruction) (set! *valid? false) - false) - + false) \ No newline at end of file diff --git a/v7/src/compiler/machines/mips/dassm3.scm b/v7/src/compiler/machines/mips/dassm3.scm index 6e717953b..d39405a6e 100644 --- a/v7/src/compiler/machines/mips/dassm3.scm +++ b/v7/src/compiler/machines/mips/dassm3.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/dassm3.scm,v 1.1 1990/05/07 04:12:32 jinx Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/dassm3.scm,v 1.2 1991/06/17 21:21:03 cph Exp $ Copyright (c) 1987, 1989, 1990 Massachusetts Institute of Technology @@ -280,7 +280,12 @@ MIT in each case. |# `(,op ,(extract word 0 26))) (define (relative-offset word) - `(@PCO ,(* 4 (extract-signed word 0 16)))) + (let ((pco (* 4 (extract-signed word 0 16)))) + (if disassembler/symbolize-output? + `(@PCR ,(let ((absolute (+ *current-offset pco))) + (or (disassembler/lookup-symbol *symbol-table absolute) + absolute))) + `(@PCO ,pco)))) (define (disassemble-branch-zero word) (let ((conditions (extract word 16 21)) diff --git a/v7/src/compiler/machines/mips/insmac.scm b/v7/src/compiler/machines/mips/insmac.scm index 20e1ffddc..48530b76c 100644 --- a/v7/src/compiler/machines/mips/insmac.scm +++ b/v7/src/compiler/machines/mips/insmac.scm @@ -1,8 +1,8 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/insmac.scm,v 1.1 1990/05/07 04:13:45 jinx Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/insmac.scm,v 1.2 1991/06/17 21:21:18 cph Exp $ -Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology +Copyright (c) 1988-91 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -40,30 +40,36 @@ MIT in each case. |# (syntax-table-define assembler-syntax-table 'DEFINE-SYMBOL-TRANSFORMER (macro (name . alist) - `(begin - (declare (integrate-operator ,name)) - (define (,name symbol) - (declare (integrate symbol)) - (let ((place (assq symbol ',alist))) - (if (null? place) + `(BEGIN + (DECLARE (INTEGRATE-OPERATOR ,name)) + (DEFINE (,name SYMBOL) + (DECLARE (INTEGRATE SYMBOL)) + (LET ((PLACE (ASSQ SYMBOL ',alist))) + (IF (NULL? PLACE) #F - (cdr place))))))) + (CDR PLACE))))))) (syntax-table-define assembler-syntax-table 'DEFINE-TRANSFORMER (macro (name value) - `(define ,name ,value))) - + `(DEFINE ,name ,value))) + ;;;; Fixed width instruction parsing (define (parse-instruction first-word tail early?) - (cond ((not (null? tail)) - (error "parse-instruction: Unknown format" (cons first-word tail))) - ((eq? (car first-word) 'LONG) - (process-fields (cdr first-word) early?)) - ((eq? (car first-word) 'VARIABLE-WIDTH) - (process-variable-width first-word early?)) - (else - (error "parse-instruction: Unknown format" first-word)))) + (if (not (null? tail)) + (error "parse-instruction: Unknown format" (cons first-word tail))) + (let loop ((first-word first-word)) + (case (car first-word) + ((LONG) + (process-fields (cdr first-word) early?)) + ((VARIABLE-WIDTH) + (process-variable-width first-word early?)) + ((IF) + `(IF ,(cadr first-word) + ,(loop (caddr first-word)) + ,(loop (cadddr first-word)))) + (else + (error "parse-instruction: Unknown format" first-word))))) (define (process-variable-width descriptor early?) (let ((binding (cadr descriptor)) @@ -83,7 +89,7 @@ MIT in each case. |# ,size ,@(car clause))))) clauses))))) - + (define (process-fields fields early?) (expand-fields fields early? diff --git a/v7/src/compiler/machines/mips/instr1.scm b/v7/src/compiler/machines/mips/instr1.scm index 549df16f3..0d64e9e82 100644 --- a/v7/src/compiler/machines/mips/instr1.scm +++ b/v7/src/compiler/machines/mips/instr1.scm @@ -1,8 +1,8 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/instr1.scm,v 1.1 1990/05/07 04:13:59 jinx Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/instr1.scm,v 1.2 1991/06/17 21:21:28 cph Exp $ -Copyright (c) 1987, 1989, 1990 Massachusetts Institute of Technology +Copyright (c) 1987-91 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -34,6 +34,9 @@ MIT in each case. |# ;;;; MIPS instruction set +;; Branch-tensioned instructions are in instr2.scm +;; Floating point instructions are in instr3.scm + (declare (usual-integrations)) (define-integrable (extract bit-string start end) @@ -234,12 +237,18 @@ MIT in each case. |# ; External labels cause the output of GC header and format words (define-instruction EXTERNAL-LABEL (((? format-word) (@PCR (? label))) - (LONG (16 label BLOCK-OFFSET) - (16 format-word UNSIGNED))) + (if (eq? endianness 'LITTLE) + (LONG (16 label BLOCK-OFFSET) + (16 format-word UNSIGNED)) + (LONG (16 format-word UNSIGNED) + (16 label BLOCK-OFFSET)))) (((? format-word) (@PCO (? offset))) - (LONG (16 offset UNSIGNED) - (16 format-word UNSIGNED)))) + (if (eq? endianness 'LITTLE) + (LONG (16 offset UNSIGNED) + (16 format-word UNSIGNED)) + (LONG (16 format-word UNSIGNED) + (16 offset UNSIGNED))))) (define-instruction PC-RELATIVE-OFFSET (((? target) (@PCR (? label))) @@ -300,15 +309,12 @@ MIT in each case. |# (LONG (6 15) ; LUI (5 0) (5 target) - (16 (adjusted:high offset)) + (16 (adjusted:high (- offset 4))) (6 9) ; ADDIU (5 target) (5 target) - (16 (adjusted:low offset) SIGNED)))))) + (16 (adjusted:low (- offset 4)) SIGNED)))))) (define-instruction NOP (() ; ADDI 0, 0 - (LONG (6 8) (5 0) (5 0) (16 0)))) - -;; Branch-tensioned instructions are in instr2.scm -;; Floating point instructions are in instr3.scm + (LONG (6 8) (5 0) (5 0) (16 0)))) \ No newline at end of file diff --git a/v7/src/compiler/machines/mips/instr2a.scm b/v7/src/compiler/machines/mips/instr2a.scm index 8fd2b1262..6ad7542ca 100644 --- a/v7/src/compiler/machines/mips/instr2a.scm +++ b/v7/src/compiler/machines/mips/instr2a.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/instr2a.scm,v 1.2 1990/11/28 22:10:56 cph Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/instr2a.scm,v 1.3 1991/06/17 21:21:34 cph Exp $ Copyright (c) 1987, 1989, 1990 Massachusetts Institute of Technology @@ -62,7 +62,7 @@ MIT in each case. |# (6 15) ; LUI (5 0) (5 1) - (16 (adjusted:high offset)) + (16 (adjusted:high (* (- offset 3) 4))) (6 1) ; BGEZAL (5 0) (5 17) @@ -70,7 +70,7 @@ MIT in each case. |# (6 9) ; ADDIU (5 1) (5 1) - (16 (adjusted:low offset) SIGNED) + (16 (adjusted:low (* (- offset 3) 4)) SIGNED) (6 0) ; ADD (5 1) (5 31) diff --git a/v7/src/compiler/machines/mips/lapgen.scm b/v7/src/compiler/machines/mips/lapgen.scm index 2c939c8fb..ede66565a 100644 --- a/v7/src/compiler/machines/mips/lapgen.scm +++ b/v7/src/compiler/machines/mips/lapgen.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/lapgen.scm,v 1.3 1990/11/29 02:11:06 cph Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/lapgen.scm,v 1.4 1991/06/17 21:21:40 cph Exp $ $MC68020-Header: lapgen.scm,v 4.26 90/01/18 22:43:36 GMT cph Exp $ Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology @@ -243,18 +243,25 @@ MIT in each case. |# ;; Handled by VARIABLE-WIDTH in instr1.scm -(define-integrable (fp-load-doubleword offset base target NOP?) - (LAP (LWC1 ,(float-register->fpr target) - (OFFSET ,offset ,base)) - (LWC1 ,(+ (float-register->fpr target) 1) - (OFFSET ,(+ offset 4) ,base)) - ,@(if NOP? (LAP (NOP)) (LAP)))) - -(define-integrable (fp-store-doubleword offset base source) - (LAP (SWC1 ,(float-register->fpr source) - (OFFSET ,offset ,base)) - (SWC1 ,(+ (float-register->fpr source) 1) - (OFFSET ,(+ offset 4) ,base)))) +(define (fp-load-doubleword offset base target NOP?) + (let* ((least (float-register->fpr target)) + (most (+ least 1))) + (if (eq? endianness 'LITTLE) + (LAP (LWC1 ,least (OFFSET ,offset ,base)) + (LWC1 ,most (OFFSET ,(+ offset 4) ,base)) + ,@(if NOP? (LAP (NOP)) (LAP))) + (LAP (LWC1 ,least (OFFSET ,(+ offset 4) ,base)) + (LWC1 ,most (OFFSET ,offset ,base)) + ,@(if NOP? (LAP (NOP)) (LAP)))))) + +(define (fp-store-doubleword offset base source) + (let* ((least (float-register->fpr source)) + (most (+ least 1))) + (if (eq? endianness 'LITTLE) + (LAP (SWC1 ,least (OFFSET ,offset ,base)) + (SWC1 ,most (OFFSET ,(+ offset 4) ,base))) + (LAP (SWC1 ,least (OFFSET ,(+ offset 4) ,base)) + (SWC1 ,most (OFFSET ,offset ,base)))))) (define (load-pc-relative label target) ;; Load a pc-relative location's contents into a machine register. diff --git a/v7/src/compiler/machines/mips/machin.scm b/v7/src/compiler/machines/mips/machin.scm index c5d72c9b9..739d2da73 100644 --- a/v7/src/compiler/machines/mips/machin.scm +++ b/v7/src/compiler/machines/mips/machin.scm @@ -1,9 +1,9 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/machin.scm,v 1.2 1990/07/22 20:21:37 jinx Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/machin.scm,v 1.3 1991/06/17 21:21:46 cph Exp $ $MC68020-Header: machin.scm,v 4.22 90/05/03 15:17:20 GMT jinx Exp $ -Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology +Copyright (c) 1988-91 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -39,7 +39,7 @@ MIT in each case. |# ;;;; Architecture Parameters -(define-integrable endianness 'LITTLE) +(define endianness 'LITTLE) (define-integrable addressing-granularity 8) (define-integrable scheme-object-width 32) (define-integrable scheme-type-width 6) ;or 8 @@ -386,7 +386,7 @@ MIT in each case. |# (define compiler:primitives-with-no-open-coding '(DIVIDE-FIXNUM GCD-FIXNUM FIXNUM-QUOTIENT FIXNUM-REMAINDER - INTEGER-QUOTIENT INTEGER-REMAINDER &/ + INTEGER-QUOTIENT INTEGER-REMAINDER &/ QUOTIENT REMAINDER FLONUM-SIN FLONUM-COS FLONUM-TAN FLONUM-ASIN FLONUM-ACOS FLONUM-ATAN FLONUM-EXP FLONUM-LOG FLONUM-TRUNCATE FLONUM-ROUND FLONUM-REMAINDER FLONUM-SQRT)) \ No newline at end of file diff --git a/v7/src/compiler/machines/mips/make.scm-big b/v7/src/compiler/machines/mips/make.scm-big index 27e83f679..4074f5b7c 100644 --- a/v7/src/compiler/machines/mips/make.scm-big +++ b/v7/src/compiler/machines/mips/make.scm-big @@ -1,7 +1,7 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/make.scm-big,v 4.84 1991/05/30 05:51:11 cph Exp $ -$MC68020-Header: /scheme/compiler/bobcat/RCS/make.scm,v 4.84 1991/05/07 13:47:44 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/make.scm-big,v 4.85 1991/06/17 21:21:52 cph Exp $ +$MC68020-Header: /scheme/compiler/machines/bobcat/RCS/make.scm,v 4.86 1991/06/12 20:54:31 cph Exp $ Copyright (c) 1988-91 Massachusetts Institute of Technology @@ -42,4 +42,4 @@ MIT in each case. |# ((package/reference (find-package name) 'INITIALIZE-PACKAGE!))) '((COMPILER MACROS) (COMPILER DECLARATIONS))) -(add-system! (make-system "Liar (MIPS)" 4 84 '())) \ No newline at end of file +(add-system! (make-system "Liar (MIPS)" 4 86 '())) \ No newline at end of file diff --git a/v7/src/compiler/machines/mips/make.scm-little b/v7/src/compiler/machines/mips/make.scm-little index 34480205c..7490b5174 100644 --- a/v7/src/compiler/machines/mips/make.scm-little +++ b/v7/src/compiler/machines/mips/make.scm-little @@ -1,7 +1,7 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/make.scm-little,v 4.84 1991/05/30 05:51:11 cph Exp $ -$MC68020-Header: /scheme/compiler/bobcat/RCS/make.scm,v 4.84 1991/05/07 13:47:44 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/make.scm-little,v 4.85 1991/06/17 21:21:52 cph Exp $ +$MC68020-Header: /scheme/compiler/machines/bobcat/RCS/make.scm,v 4.86 1991/06/12 20:54:31 cph Exp $ Copyright (c) 1988-91 Massachusetts Institute of Technology @@ -42,4 +42,4 @@ MIT in each case. |# ((package/reference (find-package name) 'INITIALIZE-PACKAGE!))) '((COMPILER MACROS) (COMPILER DECLARATIONS))) -(add-system! (make-system "Liar (MIPS)" 4 84 '())) \ No newline at end of file +(add-system! (make-system "Liar (MIPS)" 4 86 '())) \ No newline at end of file diff --git a/v7/src/compiler/machines/mips/rules1.scm b/v7/src/compiler/machines/mips/rules1.scm index 3097f5864..0334795d6 100644 --- a/v7/src/compiler/machines/mips/rules1.scm +++ b/v7/src/compiler/machines/mips/rules1.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/rules1.scm,v 1.2 1990/07/22 20:24:55 jinx Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/rules1.scm,v 1.3 1991/06/17 21:21:59 cph Exp $ $MC68020-Header: rules1.scm,v 4.33 90/05/03 15:17:28 GMT jinx Exp $ Copyright (c) 1989, 1990 Massachusetts Institute of Technology @@ -249,7 +249,12 @@ MIT in each case. |# (CHAR->ASCII (OFFSET (REGISTER (? address)) (? offset)))) (standard-unary-conversion address target (lambda (address target) - (LAP (LBU ,target (OFFSET ,(* 4 offset) ,address)) + (LAP (LBU ,target + (OFFSET ,(let ((offset (* 4 offset))) + (if (eq? endianness 'LITTLE) + offset + (+ offset 3))) + ,address)) (NOP))))) (define-rule statement diff --git a/v7/src/compiler/machines/mips/rules3.scm b/v7/src/compiler/machines/mips/rules3.scm index 0de019b33..71ef8c090 100644 --- a/v7/src/compiler/machines/mips/rules3.scm +++ b/v7/src/compiler/machines/mips/rules3.scm @@ -1,9 +1,9 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/rules3.scm,v 1.4 1990/11/28 22:32:23 cph Rel $ -$MC68020-Header: rules3.scm,v 4.26 90/08/21 02:23:26 GMT jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/rules3.scm,v 1.5 1991/06/17 21:22:05 cph Exp $ +$MC68020-Header: /scheme/compiler/bobcat/RCS/rules3.scm,v 4.30 1991/05/07 13:45:31 jinx Exp $ -Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology +Copyright (c) 1988-91 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -98,6 +98,13 @@ MIT in each case. |# continuation ;ignore (LAP ,@(clear-map!) (BGEZ 0 (@PCR ,(free-uuo-link-label name frame-size))) + (NOP))) + +(define-rule statement + (INVOCATION:GLOBAL-LINK (? frame-size) (? continuation) (? name)) + continuation ;ignore + (LAP ,@(clear-map!) + (BGEZ 0 (@PCR ,(global-uuo-link-label name frame-size))) (NOP))) ; DELAY SLOT (define-rule statement @@ -600,11 +607,10 @@ MIT in each case. |# n-sections) ;; Link all of the top level procedures within the file (LAP ,@(load-pc-relative code-block-label regnum:third-arg) - (LW ,regnum:assembler-temp ,reg:environment) + (LW ,regnum:fourth-arg ,reg:environment) ,@(object->address regnum:third-arg) - ,@(add-immediate environment-offset regnum:third-arg - regnum:second-arg) - (SW ,regnum:assembler-temp (OFFSET 0 ,regnum:second-arg)) + ,@(add-immediate environment-offset regnum:third-arg regnum:second-arg) + (SW ,regnum:fourth-arg (OFFSET 0 ,regnum:second-arg)) ,@(add-immediate free-ref-offset regnum:third-arg regnum:fourth-arg) ,@(load-immediate n-sections regnum:first-arg) (SW ,regnum:first-arg (OFFSET 16 ,regnum:C-stack-pointer)) @@ -612,13 +618,19 @@ MIT in each case. |# ,@(make-external-label (continuation-code-word false) (generate-label)))) -(define (generate/constants-block constants references assignments uuo-links) +(define (generate/constants-block constants references assignments uuo-links + global-links static-vars) (let ((constant-info (declare-constants 0 (transmogrifly uuo-links) (declare-constants 1 references (declare-constants 2 assignments - (declare-constants false constants - (cons false (LAP)))))))) + (declare-constants 3 (transmogrifly global-links) + (declare-constants false + (map (lambda (pair) + (cons false (cdr pair))) + static-vars) + (declare-constants false constants + (cons false (LAP)))))))))) (let ((free-ref-label (car constant-info)) (constants-code (cdr constant-info)) (debugging-information-label (allocate-constant-label)) @@ -626,7 +638,8 @@ MIT in each case. |# (n-sections (+ (if (null? uuo-links) 0 1) (if (null? references) 0 1) - (if (null? assignments) 0 1)))) + (if (null? assignments) 0 1) + (if (null? global-links) 0 1)))) (values (LAP ,@constants-code ;; Place holder for the debugging info filename