Some horrible flailing for the sake of correctness

This commit is contained in:
John Lorentzson 2025-07-03 20:11:08 +02:00
parent c668f4fc78
commit f814f9fbb9
2 changed files with 6 additions and 9 deletions

View file

@ -96,8 +96,7 @@
(defun emit-store-data (data) (defun emit-store-data (data)
(if (or (null (allocation-details data)) (if (or (null (allocation-details data))
(member (strategy (allocation-details data)) (eql (strategy (allocation-details data)) :constant))
'(:constant :accumulator)))
(setf *last-instruction* '(:useless)) (setf *last-instruction* '(:useless))
(progn (progn
(emit-sta :address (data-reference data)) (emit-sta :address (data-reference data))
@ -108,7 +107,7 @@
;; The "DATA is stored"-case ;; The "DATA is stored"-case
(if (or (null (allocation-details data)) (if (or (null (allocation-details data))
(member (strategy (allocation-details data)) (member (strategy (allocation-details data))
'(:constant :accumulator))) '(:constant :flags)))
(setf *last-instruction* '(:useless)) (setf *last-instruction* '(:useless))
(progn (progn
(emit-asm-instruction :opcode :php :byte-length 1) (emit-asm-instruction :opcode :php :byte-length 1)
@ -120,8 +119,7 @@
(setf *last-instruction* '(:store-zero-flag data))))) (setf *last-instruction* '(:store-zero-flag data)))))
(defun emit-load-data (data) (defun emit-load-data (data)
(if (or (member (strategy (allocation-details data)) (if (or (eql (strategy (allocation-details data)) :direct-to-argvec)
'(:accumulator :direct-to-argvec))
(equal *last-instruction* (list :store data)) (equal *last-instruction* (list :store data))
(equal *last-instruction* (list :load data))) (equal *last-instruction* (list :load data)))
(setf *last-instruction* '(:useless)) (setf *last-instruction* '(:useless))
@ -132,8 +130,7 @@
(setf *last-instruction* (list :load data))))) (setf *last-instruction* (list :load data)))))
(defun emit-load-bool (data) (defun emit-load-bool (data)
(if (or (member (strategy (allocation-details data)) (if (or (eql (strategy (allocation-details data)) :flags)
'(:accumulator))
(equal *last-instruction* (list :store-zero-flag data)) (equal *last-instruction* (list :store-zero-flag data))
(equal *last-instruction* (list :load-zero-flag data))) (equal *last-instruction* (list :load-zero-flag data)))
(setf *last-instruction* '(:useless)) (setf *last-instruction* '(:useless))

View file

@ -31,8 +31,8 @@
((typep data 'ir-variable) ((typep data 'ir-variable)
:named-variable) :named-variable)
((and (eql (next (definition data)) (last-use data)) ((and (eql (next (definition data)) (last-use data))
(not (typep (last-use data) 'ir-call))) (typep (last-use data) 'ir-if))
:accumulator) :flags)
((and (not (typep data 'ir-reusable)) ((and (not (typep data 'ir-reusable))
(typep (last-use data) 'ir-call) (typep (last-use data) 'ir-call)
(not (calls-exist-between-p (definition data) (last-use data)))) (not (calls-exist-between-p (definition data) (last-use data))))