From 05da479f3f493525805e1e594c5f39735a473f65 Mon Sep 17 00:00:00 2001 From: "Guillermo J. Rozas" Date: Mon, 24 Aug 1987 14:43:17 +0000 Subject: [PATCH] Displacements are simplified. They no longer have to discriminate between @PCO and @PCR. --- v7/src/compiler/machines/vax/insmac.scm | 45 +++++-------------------- v7/src/compiler/machines/vax/instr1.scm | 16 ++++----- 2 files changed, 15 insertions(+), 46 deletions(-) diff --git a/v7/src/compiler/machines/vax/insmac.scm b/v7/src/compiler/machines/vax/insmac.scm index 1cc128bec..8f52a2dda 100644 --- a/v7/src/compiler/machines/vax/insmac.scm +++ b/v7/src/compiler/machines/vax/insmac.scm @@ -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)))))))) -(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) diff --git a/v7/src/compiler/machines/vax/instr1.scm b/v7/src/compiler/machines/vax/instr1.scm index bd30fdc1f..07f20d2b9 100644 --- a/v7/src/compiler/machines/vax/instr1.scm +++ b/v7/src/compiler/machines/vax/instr1.scm @@ -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 -- 2.25.1