home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / t3_1 / nexttsrc.lha / nexttsources / sources / comp / assembler / as_vax.t < prev    next >
Encoding:
Text File  |  1988-02-05  |  4.7 KB  |  128 lines

  1. (herald (assembler as_vax t 0)
  2.         (env t (assembler as)))
  3.  
  4. ;;; Copyright (c) 1985 Yale University
  5. ;;;     Authors: N Adams, R Kelsey, D Kranz, J Philbin, J Rees.
  6. ;;; This material was developed by the T Project at the Yale University Computer 
  7. ;;; Science Department.  Permission to copy this software, to redistribute it, 
  8. ;;; and to use it for any purpose is granted, subject to the following restric-
  9. ;;; tions and understandings.
  10. ;;; 1. Any copy made of this software must include this copyright notice in full.
  11. ;;; 2. Users of this software agree to make their best efforts (a) to return
  12. ;;;    to the T Project at Yale any improvements or extensions that they make,
  13. ;;;    so that these may be included in future releases; and (b) to inform
  14. ;;;    the T Project of noteworthy uses of this software.
  15. ;;; 3. All materials developed as a consequence of the use of this software
  16. ;;;    shall duly acknowledge such use, in accordance with the usual standards
  17. ;;;    of acknowledging credit in academic research.
  18. ;;; 4. Yale has made no warrantee or representation that the operation of
  19. ;;;    this software will be error-free, and Yale is under no obligation to
  20. ;;;    provide any services, by way of maintenance, update, or otherwise.
  21. ;;; 5. In conjunction with products arising from the use of this material,
  22. ;;;    there shall be no use of the name of the Yale University nor of any
  23. ;;;    adaptation thereof in any advertising, promotional, or sales literature
  24. ;;;    without prior written consent from Yale in each case.
  25. ;;;
  26.  
  27.  
  28. ;;; VAX machine information
  29.                          
  30. (define *vax-machine* (make-machine))
  31.  
  32. ;;; Create VAX lap environment under orbit.
  33.  
  34. (new-lap-env *vax-machine* orbit-env '*vax-lap-env*)
  35.  
  36. (define (*define-lap-vax sym val) 
  37.    (*define-lap *vax-machine* sym val))
  38.  
  39. ;;; Lap interface for the compiler
  40.  
  41. (define (losing-vax-process-lap-list items)
  42.     (if (null? *current-ib*) (emit-tag (generate-symbol 'lap-entry)))
  43.     (process-lap-list items *vax-machine*))
  44.  
  45. (define lap-transduce losing-vax-process-lap-list)
  46.  
  47. ;;; For testing lap
  48.  
  49. (define-syntax (vaxlap . items)  
  50.   `(test-lap ',items *vax-machine*))
  51.  
  52. ;;; Some quick definitions for what follows
  53.  
  54. (define *vax-pseudo-operands* 
  55.    (pseudos-alist 
  56.       ((label tag)    (vax/label tag))   
  57.       ((template tag) (vax/label tag))   
  58.       ((to tag)       (data-current-label tag))
  59.       ((static id)    (static id))
  60.       ))
  61.  
  62. (define *vax-pseudo-ops* 
  63.    (pseudos-alist 
  64.        ((j=  1tag) (vax-lap-jbcc jump-op/j=  1tag))
  65.        ((jn= 1tag) (vax-lap-jbcc jump-op/jn= 1tag))
  66.        ((j>  1tag) (vax-lap-jbcc jump-op/j>  1tag))
  67.        ((j>= 1tag) (vax-lap-jbcc jump-op/j>= 1tag))
  68.        ((j<  1tag) (vax-lap-jbcc jump-op/j<  1tag))
  69.        ((j<= 1tag) (vax-lap-jbcc jump-op/j<= 1tag))
  70.        ((jbr 1tag) (vax-lap-jbcc jump-op/jabs 1tag))
  71.  
  72.        ((space number)    (vax/space number))
  73.        ;; loser
  74.        ((jump . args)     (apply emit-jump args))       ; -- state machine, ibs
  75.        ;; loser
  76.        ((template . args) (apply %emit-template args))  ; -- state machine, ib
  77.        ((byte number) (vax/byte number))
  78.        ((word number) (vax/word number))
  79.        ((long number) (vax/long number))
  80.        ((block . forms) (eval `(block ,@forms) (machine-lap-env *vax-machine*)))
  81.        ((equate id form) (*define-lap-vax id (eval form (machine-lap-env *vax-machine*))))
  82.        ))
  83.  
  84. (define (vax-lap-jbcc jump-op 1tag)
  85.   (let ((next-tag (generate-symbol 'vax-lap-jbcc)))
  86.     (emit-jump-to-ib *current-ib* jump-op 1tag next-tag)
  87.     (emit-tag next-tag)))
  88.  
  89. (*define-lap-vax 'number make-as-number)
  90.  
  91. ;;; Losing near-parameterizations.
  92.  
  93. (define (losing-vax-emit opcode-fg . operands)
  94.   (emit-to-ib *current-ib* (apply opcode-fg operands))
  95.   (flush-delayed-comments))
  96.  
  97. (define (vaxemit fg)
  98.   (emit-to-ib *current-ib* fg)
  99.   (flush-delayed-comments))
  100.  
  101. (define %emit losing-vax-emit)
  102.  
  103. (set *pretty-print-tag* pp-ib-as-name-or-hash)
  104. (set *current-machine* *vax-machine*) 
  105.  
  106. ;;; Set machine parameters 
  107.  
  108. ;;; These are in VAXI
  109. ;(set (machine-template-emitter *vax-machine*) emit-vax-template)
  110. ;(set (machine-cond-branch      *vax-machine*) vax/jcc)
  111. ;(set (machine-uncond-branch    *vax-machine*) vax/jbr)         
  112.  
  113. (set (machine-clump-size       *vax-machine*) 8)
  114. (set (machine-maximum-clumps   *vax-machine*) 4)
  115. (set (machine-clump-writer     *vax-machine*) vax/write-clumps)
  116. (set (machine-pseudo-ops       *vax-machine*) *vax-pseudo-ops*)
  117. (set (machine-pseudo-operands  *vax-machine*) *vax-pseudo-operands*)
  118.  
  119. ;;; Handy items for lap env
  120.  
  121. (walk *define-lap-vax
  122.       '(r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15)
  123.       '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)) 
  124.                                      
  125. (walk *define-lap-vax
  126.       '(S0 S1 S2 S3 NARGS P A1 A2 A3 A4 AN AN-1 TP nil-reg AP TASK FP SP)
  127.       '(0  1   2 3  3     4 5  6  7  8  9  8    10 11      12 12   13 14))
  128.