From 383277dc059f85b3314e7407ae2d4cec686a40b9 Mon Sep 17 00:00:00 2001 From: Bike Date: Fri, 14 May 2021 16:50:51 -0400 Subject: [PATCH] Delete multiple-to-fixed --- BIR-to-CL/decompile.lisp | 5 ----- BIR-transformations/interpolate-function.lisp | 12 +--------- BIR/graph-modifications.lisp | 22 ------------------- BIR/instructions.lisp | 3 --- BIR/packages.lisp | 4 ++-- 5 files changed, 3 insertions(+), 43 deletions(-) diff --git a/BIR-to-CL/decompile.lisp b/BIR-to-CL/decompile.lisp index 7e2a58e8..26454e80 100644 --- a/BIR-to-CL/decompile.lisp +++ b/BIR-to-CL/decompile.lisp @@ -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) diff --git a/BIR-transformations/interpolate-function.lisp b/BIR-transformations/interpolate-function.lisp index d6fb00f0..91dc61b0 100644 --- a/BIR-transformations/interpolate-function.lisp +++ b/BIR-transformations/interpolate-function.lisp @@ -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. diff --git a/BIR/graph-modifications.lisp b/BIR/graph-modifications.lisp index a8d7e7bd..3d6beb1a 100644 --- a/BIR/graph-modifications.lisp +++ b/BIR/graph-modifications.lisp @@ -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)) diff --git a/BIR/instructions.lisp b/BIR/instructions.lisp index dccfb7c9..5621ab26 100644 --- a/BIR/instructions.lisp +++ b/BIR/instructions.lisp @@ -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) diff --git a/BIR/packages.lisp b/BIR/packages.lisp index 7e60c8d6..ca3d73ef 100644 --- a/BIR/packages.lisp +++ b/BIR/packages.lisp @@ -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 @@ -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)