From 4a52ff534f43739eede43fcbb37aa842730590c9 Mon Sep 17 00:00:00 2001 From: John Lorentzson Date: Mon, 7 Jul 2025 14:37:45 +0200 Subject: [PATCH] Remove now unused and useless functions from compiler backend --- .../backend/code-generator.lisp | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/wip-duuqnd/user-side-compiler/backend/code-generator.lisp b/wip-duuqnd/user-side-compiler/backend/code-generator.lisp index e5b6d79..b6c4d3f 100644 --- a/wip-duuqnd/user-side-compiler/backend/code-generator.lisp +++ b/wip-duuqnd/user-side-compiler/backend/code-generator.lisp @@ -126,21 +126,6 @@ is the responsibility of the pre-assembly compilation step." (emit-sta (data-reference data)))) (setf *last-instruction* (list :store data))))) -(defun emit-store-bool (data) - "Stores the inverse of the zeroflag to DATA. Inverse so that non-0 is TRUE." - ;; The "DATA is stored"-case - (if (or (member (strategy (allocation-details data)) - '(:constant :branch :not-saved))) - (setf *last-instruction* :useless) - (progn - (emit-asm-instruction :opcode :php :byte-length 1) - (emit-asm-instruction :opcode :pla :byte-length 1) - (emit-asm-instruction :opcode :and :operand #b00000010 :byte-length 2) - (emit-asm-instruction :opcode :lsr-a :byte-length 1) - (emit-asm-instruction :opcode :not :operand #b00000001 :byte-length 2) - (emit-sta :address (data-reference data)) - (setf *last-instruction* (list :store-zero-flag data))))) - (defun emit-load-data (data) (cond ((eql (strategy (allocation-details data)) :not-saved) (error "Tried to load unallocated data ~A." data)) @@ -159,23 +144,6 @@ is the responsibility of the pre-assembly compilation step." (emit-lda (data-reference data)) (setf *last-instruction* (list :load data))))) -(defun emit-load-bool (data) - (if (or (eql (strategy (allocation-details data)) :flags) - (equal *last-instruction* (list :store-zero-flag data)) - (equal *last-instruction* (list :load-zero-flag data))) - (setf *last-instruction* :useless) - (progn - (if (eql (strategy (allocation-details data)) :constant) - (progn - (emit-lda :immediate (ir-constant-value data)) - (emit-asm-instruction :opcode :and :operand 1 :byte-length 1) - (emit-cmp :immediate 1)) - (progn - (emit-lda :address (data-reference data)) - (emit-asm-instruction :opcode :and :operand 1 :byte-length 1) - (emit-cmp :immediate 1))) - (setf *last-instruction* (list :load-zero-flag data))))) - (defmethod compile-ir ((inst ir-inst)) (warn "Skipped compiling ~A; no COMPILE-IR method" inst))