Displacements are simplified. They no longer have to discriminate
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Mon, 24 Aug 1987 14:43:17 +0000 (14:43 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Mon, 24 Aug 1987 14:43:17 +0000 (14:43 +0000)
between @PCO and @PCR.

v7/src/compiler/machines/vax/insmac.scm
v7/src/compiler/machines/vax/instr1.scm

index 1cc128bece6bbe45aec84fab56d6305b96e71d92..8f52a2ddaa13ab5a23a319bd4ff9b9c57c3c2c1f 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/vax/insmac.scm,v 1.9 1987/08/23 07:56:16 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/vax/insmac.scm,v 1.10 1987/08/24 14:39:29 jinx Exp $
 
 Copyright (c) 1987 Massachusetts Institute of Technology
 
@@ -126,15 +126,15 @@ MIT in each case. |#
                    `(EA-VALUE ,(caddar fields)))
               ,tail)
             tail-size))
+          ;; Displacements are like signed bytes.  They are a different
+          ;; keyword to allow the disassembler to do its thing correctly.
           ((DISPLACEMENT)
-           (let ((desc (cadar fields)))
-             (let ((expression (cadr desc))
-                   (size (car desc)))
-               (receiver
-                `(CONS-SYNTAX
-                  ,(displacement-syntaxer expression size)
-                  ,tail)
-                (+ size tail-size)))))
+           (let* ((desc (cadar fields))
+                  (size (car desc)))
+             (receiver
+              `(CONS-SYNTAX ,(integer-syntaxer (cadr desc) 'SIGNED size)
+                            ,tail)
+              (+ size tail-size))))
           ((IMMEDIATE)
            (receiver
             `(CONS-SYNTAX
@@ -144,33 +144,6 @@ MIT in each case. |#
           (else
            (error "expand-fields: Unknown field kind" (caar fields))))))))
 \f
-(define (displacement-syntaxer expression size)
-  (cond ((not (pair? expression))
-        `(SYNTAX-DISPLACEMENT ,expression
-                              ,(make-coercion-name 'SIGNED size)))
-       ((eq? '@PCO (car expression))
-        (integer-syntaxer (cadr expression) 'SIGNED size))
-       ((eq? '@PCR (car expression))
-        (nteger-syntaxer `(- ,(cadr expression)
-                             (+ *PC* ,(/ size 8))) 'SIGNED size))
-       (else
-        `(SYNTAX-DISPLACEMENT ,expression
-                              ,(make-coercion-name 'SIGNED size)))))
-
-(define (syntax-displacement expression coercion)
-  (cond ((not (pair? expression))
-        (error "syntax-displacement: bad displacement specifier"
-               expression))
-       ((eq? (car expression) '@PCO)
-        (syntax-evaluation (cadr expression) coercion))
-       ((eq? (car expression) '@PCR)
-        (syntax-evaluation `(- ,(cadr expression)
-                               (+ *PC* ,(/ (coercion-size coercion) 8)))
-                           coercion))
-       (else
-        (error "syntax-displacement: bad displacement specifier"
-               expression))))
-
 (define (collect-byte components tail receiver)
   (define (inner components receiver)
     (if (null? components)
index bd30fdc1fd5a0a5b0c3a8b7e1d54439ecb31dd54..07f20d2b9b3264ec78afeb9d370b6ea4a858c068 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/vax/instr1.scm,v 1.4 1987/08/19 04:40:53 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/vax/instr1.scm,v 1.5 1987/08/24 14:43:17 jinx Exp $
 
 Copyright (c) 1987 Massachusetts Institute of Technology
 
@@ -42,7 +42,7 @@ MIT in each case. |#
 
 #|
 
-A) There are three types of operand specifiers:
+A) There are two types of operand specifiers:
 
     - General addressing mode operand specifier, with matching pattern syntax
 
@@ -52,14 +52,10 @@ A) There are three types of operand specifiers:
       Handbook", on Appendix E. 
       They are implemented in insutl.scm
 
-    - Displacement for branch instructions.  The matching pattern syntax is
-
-      (? value displacement)
-
-      This matches either (@PCO offset) or (@PCR label).
-
-    - Immediate operand.  Only the BUG instruction uses this.  The
-      matching syntax is (? value).      
+    - Immediate operands.  The matching syntax is (? value).  The operand
+      is processed appropriately by the body of the instruction definition.
+      It is used for instruction displacements (ie. the SOB instruction), or
+      immediate operands (ie. the BUG instruction).
 
 B) The instruction set is currently incomplete.  In particular, none
 of the instructions in chapters 14 or 16 are below.  The missing