Change disassembly of EXTERNAL-LABEL to use (@PCR label) where
authorChris Hanson <org/chris-hanson/cph>
Mon, 12 Aug 1991 22:11:08 +0000 (22:11 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 12 Aug 1991 22:11:08 +0000 (22:11 +0000)
possible.

v7/src/compiler/machines/mips/dassm2.scm
v7/src/compiler/machines/mips/dassm3.scm

index 34165557e343b595fdf58fe72382cc33cad2a0dc..c00fdabc6efcb9c7b02ed510a04b1bddc24a2e24 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$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 $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/dassm2.scm,v 1.3 1991/08/12 22:10:29 cph Exp $
 $MC68020-Header: dassm2.scm,v 4.16 89/12/11 06:16:42 GMT cph Exp $
 
 Copyright (c) 1988-91 Massachusetts Institute of Technology
@@ -156,25 +156,8 @@ MIT in each case. |#
   'INSTRUCTION-NEXT)
 
 (define (disassembler/next-state instruction state)
-  (cond ((not disassembler/compiled-code-heuristics?)
-        'INSTRUCTION)
-       ((and (eq? state 'INSTRUCTION)
-             (equal? instruction '(BL () 1 (@PCO 0))))
-        'PC-REL-DEP)
-       ((and (eq? state 'PC-REL-DEP)
-             (equal? instruction '(DEP () 0 31 2 1)))
-        'PC-REL-OFFSET)
-       ((and (eq? state 'PC-REL-OFFSET)
-             (= (length instruction) 4)
-             (equal? (list (car instruction)
-                           (cadr instruction)
-                           (cadddr instruction))
-                     '(ADDIL () 1)))
-        (list 'PC-REL-LOW-OFFSET (caddr instruction)))
-       ((memq (car instruction) '(B BV BLE))
-        'EXTERNAL-LABEL)
-       (else
-        'INSTRUCTION)))
+  instruction state
+  'INSTRUCTION)
 \f
 (set! disassembler/lookup-symbol
   (lambda (symbol-table offset)
@@ -205,13 +188,15 @@ MIT in each case. |#
   `(UWORD ,(bit-string->unsigned-integer bit-string)))
 
 (define (make-external-label bit-string)
-  (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))))))
+  (let ((do-it
+        (lambda (format-word offset)
+          `(EXTERNAL-LABEL (FORMAT ,format-word)
+                           ,(offset->@pcr (* 2 offset))))))
+    (if (eq? endianness 'LITTLE)
+       (do-it (extract bit-string 0 16)
+              (extract bit-string 16 32))
+       (do-it (extract bit-string 16 32)
+              (extract bit-string 0 16)))))
 
 #|
 ;;; 68k version
index d39405a6ebaf47a7bd120b710445526a38f35f92..07771e1bc87d2119d613bbd3e308e799414ae684 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$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 $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/dassm3.scm,v 1.3 1991/08/12 22:11:08 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
@@ -280,12 +280,12 @@ MIT in each case. |#
   `(,op ,(extract word 0 26)))
 
 (define (relative-offset word)
-  (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))))
+  (offset->@pcr (+ *current-offset (* 4 (extract-signed word 0 16)))))
+
+(define (offset->@pcr offset)
+  `(@PCR ,(or (and disassembler/symbolize-output?
+                  (disassembler/lookup-symbol *symbol-table offset))
+             offset)))
 
 (define (disassemble-branch-zero word)
   (let ((conditions (extract word 16 21))