Add compilation method for IR-IF
This commit is contained in:
parent
3876801960
commit
a24c5353a5
1 changed files with 15 additions and 0 deletions
|
@ -191,6 +191,21 @@
|
|||
:byte-length 3))
|
||||
(setf *last-instruction* '(:jump)))
|
||||
|
||||
(defmethod compile-ir ((inst ir-if))
|
||||
(let ((next-iblock (next (iblock inst)))
|
||||
(then-iblock (first (destinations inst)))
|
||||
(else-iblock (second (destinations inst))))
|
||||
;; With how the midstage is built, the true case's block comes immediately
|
||||
;; after the IF, and therefore we should branch on false. This assert
|
||||
;; ensures that this assumption become false without us noticing.
|
||||
;; We implicitly fall through to THEN-BLOCK in the event of no branch.
|
||||
(assert (eql next-iblock then-iblock))
|
||||
(emit-load-bool (input inst))
|
||||
(emit-asm-instruction :opcode #xD0
|
||||
:operand else-iblock
|
||||
:byte-length 2)
|
||||
(setf *last-instruction* '(:conditional))))
|
||||
|
||||
(defmethod compile-ir ((inst ir-test-equal))
|
||||
(emit-load-data (first (inputs inst)))
|
||||
(if (eql (strategy (allocation-details (second (inputs inst))))
|
||||
|
|
Loading…
Add table
Reference in a new issue