1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00

* Reorganize passes

- Make propagate responsible for keeping SSA up to date.

- Run propagate-alloc as very last before final not to risk bothering
  with mvar array allocation during previous tranformations.

- Fix SSA if TCO modify the CFG.
This commit is contained in:
Andrea Corallo 2020-02-29 17:38:50 +00:00
parent f60cb02cdf
commit 0cef208cc3

View file

@ -120,12 +120,12 @@ Can be one of: 'd-default', 'd-impure' or 'd-ephemeral'. See `comp-ctxt'.")
(defconst comp-passes '(comp-spill-lap (defconst comp-passes '(comp-spill-lap
comp-limplify comp-limplify
comp-ssa comp-propagate
comp-propagate-1
comp-call-optim comp-call-optim
comp-propagate-2 comp-propagate
comp-dead-code comp-dead-code
comp-tco comp-tco
comp-propagate-alloc
comp-final) comp-final)
"Passes to be executed in order.") "Passes to be executed in order.")
@ -1546,7 +1546,7 @@ PRE-LAMBDA and POST-LAMBDA are called in pre or post-order if non nil."
when (eq op 'phi) when (eq op 'phi)
do (finalize-phi args b))))) do (finalize-phi args b)))))
(defun comp-ssa (_) (defun comp-ssa ()
"Port all functions into mininal SSA form." "Port all functions into mininal SSA form."
(maphash (lambda (_ f) (maphash (lambda (_ f)
(let* ((comp-func f) (let* ((comp-func f)
@ -1736,7 +1736,8 @@ Return t if something was changed."
do (setf modified t)) do (setf modified t))
finally return modified)) finally return modified))
(defun comp-propagate-iterate (backward) (defun comp-propagate1 (backward)
(comp-ssa)
(when (>= comp-speed 2) (when (>= comp-speed 2)
(maphash (lambda (_ f) (maphash (lambda (_ f)
;; FIXME remove the following condition when tested. ;; FIXME remove the following condition when tested.
@ -1750,14 +1751,14 @@ Return t if something was changed."
(comp-log-func comp-func 3)))) (comp-log-func comp-func 3))))
(comp-ctxt-funcs-h comp-ctxt)))) (comp-ctxt-funcs-h comp-ctxt))))
(defun comp-propagate-1 (_) (defun comp-propagate (_)
"Forward propagate types and consts within the lattice." "Forward propagate types and consts within the lattice."
(comp-propagate-iterate nil)) (comp-propagate1 nil))
(defun comp-propagate-2 (_) (defun comp-propagate-alloc (_)
"Forward propagate types and consts within the lattice. "Forward propagate types and consts within the lattice.
Backward propagate array placement properties." Backward propagate array placement properties."
(comp-propagate-iterate t)) (comp-propagate1 t))
;;; Call optimizer pass specific code. ;;; Call optimizer pass specific code.