Changes to get compiler running on big-endian MIPS.
authorChris Hanson <org/chris-hanson/cph>
Mon, 17 Jun 1991 21:22:05 +0000 (21:22 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 17 Jun 1991 21:22:05 +0000 (21:22 +0000)
13 files changed:
v7/src/compiler/machines/mips/assmd.scm
v7/src/compiler/machines/mips/compiler.pkg
v7/src/compiler/machines/mips/dassm2.scm
v7/src/compiler/machines/mips/dassm3.scm
v7/src/compiler/machines/mips/insmac.scm
v7/src/compiler/machines/mips/instr1.scm
v7/src/compiler/machines/mips/instr2a.scm
v7/src/compiler/machines/mips/lapgen.scm
v7/src/compiler/machines/mips/machin.scm
v7/src/compiler/machines/mips/make.scm-big
v7/src/compiler/machines/mips/make.scm-little
v7/src/compiler/machines/mips/rules1.scm
v7/src/compiler/machines/mips/rules3.scm

index c6cae393da7040fc98ed236e65aacce501cbc927..f5b55dffc5b22eaac345853d65e055b00c31c4c7 100644 (file)
@@ -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
index f840694872ec59d627e9b873f0b1c6dbe165bdb7..dfd6871d4510c9984d959a72b91ae738396b3394 100644 (file)
@@ -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*
index 1a6c408990bed670fd290c6c294d7dc3c8d3a3e8..34165557e343b595fdf58fe72382cc33cad2a0dc 100644 (file)
@@ -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
index 6e717953b98d4e185336aa41fb761e0953d5c1d9..d39405a6ebaf47a7bd120b710445526a38f35f92 100644 (file)
@@ -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))
index 20e1ffddcca2ee1033123ab133e21b2a8bf0dbd1..48530b76c690611d9e2c509e86edb98ca78ca717 100644 (file)
@@ -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)))
-\f
+    `(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)))))
-
+\f
 (define (process-fields fields early?)
   (expand-fields fields
                 early?
index 549df16f3c3439e0edab22ef4e40c94179e479f1..0d64e9e82ab8d97236c1c05de52d1f92582346c7 100644 (file)
@@ -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))
 \f
 (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
index 8fd2b1262bf2226e4ed842108dde3fdc1b7bf0ab..6ad7542ca6b4c60983a91edac873c1c4aea553f1 100644 (file)
@@ -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)
index 2c939c8fb55215c2429889565163559dc7cd7a1f..ede66565a5100a7431f4f73060ac293a2dff0071 100644 (file)
@@ -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.
index c5d72c9b9950c0ddd09e33d95d534622b8156a2a..739d2da73433e14fa60af84d6ba33428406a1943 100644 (file)
@@ -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. |#
 \f
 ;;;; 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
index 27e83f679fab8089768f04e6e86bae5d888e825f..4074f5b7ce1d1fe3939f9adb46d27b5a904f55d6 100644 (file)
@@ -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
index 34480205c9a770c33f76e576edcd5ae5398988a6..7490b517420629b31aa81fdd21504b2fe0987358 100644 (file)
@@ -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
index 3097f5864dd8b4f04124bd01905364d8cd796db3..0334795d689feaa57327a810d0327f3e3600a43e 100644 (file)
@@ -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
index 0de019b33095a31a348621e6da4296de7d0d977b..71ef8c09060ff4b9f984b20b79a1c29b6f063c79 100644 (file)
@@ -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))))
 \f
-(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