home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / t3_1 / risc_src.lha / risc_sources / comp / assembler / fix.t < prev    next >
Encoding:
Text File  |  1989-06-30  |  1.0 KB  |  37 lines

  1. (herald fix)
  2.  
  3. (define (add-jump next i is cc)
  4.   (let ((insts (ib-instructions next)))
  5.     (cond ((or (null? insts)
  6.            (fxn= (car cc) jump-op/jabs)
  7.            (branch-instruction? (car insts)))
  8.        (return (fx+ i (fx* CELL 2))
  9.            (cons noop-inst 
  10.              (cons (list jbr-inst nil cc (cons 'label next))
  11.                    is))))
  12.       (else
  13.        (return (fx+ i (fx* CELL 2))
  14.            (cons (car insts) 
  15.              (cons (list jbr-inst nil cc (cons 'label+1 next))
  16.                    is)))))))
  17.  
  18. (define (branch-instruction? x)
  19.   (or (eq? (car x) mips/jalr)
  20.       (eq? (car x) mips/jr)
  21.       (eq? (car x) jbr-inst)
  22.       (eq? (car x) maybe-popfr)
  23.       (eq? (car x) maybe-pushfr)))
  24.  
  25. (define (need-to-delay? load rest)
  26.   (if (null? rest)
  27.       '#t
  28.       (let ((write (apply write-register mips/load (cddr load))));flush comment
  29.     (destructure (((op #f . args) (car rest)))
  30.       (select  op
  31.         ((maybe-pushfr maybe-popfr)
  32.          (fx= (lambda-max-temps (car args)) 0))
  33.         (else
  34.          (receive (r1 r2) (apply read-registers op args)
  35.            (or (fx= write r1) (fx= write r2)))))))))
  36.     
  37.