X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=experimental%2Fcompiler.lisp;h=49ed56efbc17b8d15dfcf946977b00219a59eb1a;hb=9a9a53eada042ce6867c32fdb8431632bb87cc15;hp=9122f3cb2004bb62cf509034c6250c2205277d01;hpb=e6808339bf3884e587f646807e2baeb68a26db57;p=jscl.git diff --git a/experimental/compiler.lisp b/experimental/compiler.lisp index 9122f3c..49ed56e 100644 --- a/experimental/compiler.lisp +++ b/experimental/compiler.lisp @@ -156,6 +156,8 @@ entry exit ;; The component where the basic block belongs to. component + ;; The order in the reverse post ordering of the blocks. + order ;; A bit-vector representing the set of dominators. See the function ;; `compute-dominators' to know how to use it properly. dominators% @@ -765,9 +767,11 @@ ;;;; abstractions to use this information. (defun compute-reverse-post-order (component) - (let ((output nil)) + (let ((output nil) + (count 0)) (flet ((add-block-to-list (block) - (push block output))) + (push block output) + (setf (block-order block) (incf count)))) (map-postorder-blocks #'add-block-to-list component)) (setf (component-reverse-post-order-p component) t) (setf (component-blocks component) output))) @@ -819,6 +823,11 @@ (setf changes (or changes (not (equal (block-dominators% block) (block-dominators% block))))) (incf i))))) +;;; Return T if BLOCK1 dominates BLOCK2, else return NIL. +(defun dominate-p (block1 block2) + (let ((order (block-order block1))) + (= 1 (aref (block-dominators% block2) order)))) + ;;;; IR Debugging ;;;;