Add compilation method for IR-TEST-EQUAL
This commit is contained in:
parent
dda08e6fe7
commit
f9d8ad13d0
1 changed files with 9 additions and 0 deletions
|
@ -92,6 +92,7 @@
|
|||
(define-normal-emitter emit-lda #xa9 #xa5 #xad)
|
||||
(define-normal-emitter emit-sta (error "STA has no immediate mode.") #x85 #x8d)
|
||||
(define-normal-emitter emit-adc #x69 #x65 #x6d)
|
||||
(define-normal-emitter emit-cmp #xc9 #xc5 #xcd)
|
||||
|
||||
(defun emit-store-data (data)
|
||||
(if (or (null (allocation-details data))
|
||||
|
@ -182,6 +183,14 @@
|
|||
(emit-asm-instruction :opcode #x20 :operand (callee inst) :byte-length 3)
|
||||
(emit-store-result (output inst)))
|
||||
|
||||
(defmethod compile-ir ((inst ir-test-equal))
|
||||
(emit-load-data (first (inputs inst)))
|
||||
(if (eql (strategy (allocation-details (second (inputs inst))))
|
||||
:constant)
|
||||
(emit-cmp :immediate (ir-constant-value (second (inputs inst))))
|
||||
(emit-cmp :address (data-reference (second (inputs inst)))))
|
||||
(emit-store-bool (output inst)))
|
||||
|
||||
(defun link-compute-addresses (start-instruction origin-address)
|
||||
"First linking pass, computes the addresses of all labels."
|
||||
(let ((address origin-address))
|
||||
|
|
Loading…
Add table
Reference in a new issue