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

View file

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