Skip to content

Commit

Permalink
Delete multiple-to-fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Bike committed May 14, 2021
1 parent a5cae86 commit 383277d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 43 deletions.
5 changes: 0 additions & 5 deletions BIR-to-CL/decompile.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@
(list `(setq ,(decompile-datum inst)
(list ,@(mapcar #'decompile-datum (cleavir-bir:inputs inst))))))

(defmethod decompile-instruction ((inst cleavir-bir:multiple-to-fixed))
(list `(multiple-value-setq
(,@(mapcar #'decompile-datum (cleavir-bir:outputs inst)))
(values-list ,(decompile-datum (first (cleavir-bir:inputs inst)))))))

(defun decompile-iblock (iblock)
(loop for instruction = (cleavir-bir:start iblock)
then (cleavir-bir:successor instruction)
Expand Down
12 changes: 1 addition & 11 deletions BIR-transformations/interpolate-function.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -265,17 +265,7 @@
(when returni
(cleavir-bir:merge-successor-if-possible (cleavir-bir:iblock returni)))
(when unique-call
(cleavir-bir:merge-successor-if-possible (cleavir-bir:iblock unique-call))
;; TODO: can generalize this to the case of more than
;; one outside call.
;; If we have a FTM->MTF sequence, clear it out.
(when (and common-use
(typep common-use 'cleavir-bir:multiple-to-fixed))
(let ((cuinput (cleavir-bir:input common-use)))
(when (typep cuinput 'cleavir-bir:output)
(let ((cudef (cleavir-bir:definition cuinput)))
(when (typep cudef 'cleavir-bir:fixed-to-multiple)
(cleavir-bir:delete-ftm-mtf-pair cudef common-use)))))))
(cleavir-bir:merge-successor-if-possible (cleavir-bir:iblock unique-call)))
;; We've interpolated and there are potentially useless
;; catches in TARGET-OWNER, so now that the IR is in a
;; consistent state, eliminate them.
Expand Down
22 changes: 0 additions & 22 deletions BIR/graph-modifications.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -301,28 +301,6 @@
(when (use old)
(setf (%use old) nil)))

;;; Delete a pair of fixed-to-multiple and multiple-to-fixed instructions.
(defun delete-ftm-mtf-pair (ftm mtf)
(let ((outputs (outputs mtf))
(inputs (inputs ftm)))
;; Prepare for ownership change
(setf (inputs ftm) nil (outputs mtf) nil)
;; Replace and default values.
(do ((inputs inputs (rest inputs))
(outputs outputs (rest outputs)))
((null inputs)
(unless (null outputs) ; Don't create the constant unless we have to.
(let ((nil-const (constant-in-module nil (module (function ftm)))))
(dolist (output outputs)
(let ((nil-ref (make-instance 'constant-reference
:inputs (list nil-const)
:outputs (list output))))
(insert-instruction-before nil-ref ftm))))))
(when outputs
(replace-uses (first inputs) (first outputs)))))
(delete-instruction mtf)
(delete-instruction ftm))

;;; Remove IBLOCK from its flow ordering.
(defun remove-iblock-from-flow-order (iblock)
(let ((prev (%prev iblock))
Expand Down
3 changes: 0 additions & 3 deletions BIR/instructions.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@
;;; Convert an aggregate of :objects into a :multiple-values
(defclass fixed-to-multiple (one-output instruction) ())

;;; Reverse of the above
(defclass multiple-to-fixed (one-input instruction) ())

;;; Represents a type assertion on the first input.
(defclass thei (one-input one-output instruction)
((%asserted-type :initarg :asserted-type :accessor asserted-type)
Expand Down
4 changes: 2 additions & 2 deletions BIR/packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#:successor #:predecessor #:next
#:origin #:policy)
(:export #:*origin* #:*policy* #:*top-ctype* #:*top-function-ctype*)
(:export #:multiple-to-fixed #:fixed-to-multiple
(:export #:fixed-to-multiple
#:accessvar #:writevar #:readvar
#:constant-reference #:make-constant-reference
#:load-time-value-reference #:make-load-time-value-reference
Expand All @@ -49,7 +49,7 @@
(:export #:map-local-instructions
#:insert-instruction-before #:insert-instruction-after
#:delete-instruction
#:delete-ftm-mtf-pair #:replace-uses #:replace-terminator
#:replace-uses #:replace-terminator
#:split-block-after #:delete-iblock #:maybe-delete-iblock
#:clean-up-iblock #:merge-successor-if-possible #:delete-iblock-if-empty)
(:export #:map-lambda-list)
Expand Down

0 comments on commit 383277d

Please sign in to comment.