X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=experimental%2Fcompiler.lisp;h=49ed56efbc17b8d15dfcf946977b00219a59eb1a;hb=9a9a53eada042ce6867c32fdb8431632bb87cc15;hp=aa5e593c3dd994392c5393966a545f79f3faee53;hpb=7325ab8ad855880e88c351ea1cfc6b20d980282e;p=jscl.git diff --git a/experimental/compiler.lisp b/experimental/compiler.lisp index aa5e593..49ed56e 100644 --- a/experimental/compiler.lisp +++ b/experimental/compiler.lisp @@ -156,8 +156,10 @@ entry exit ;; The component where the basic block belongs to. component - ;; A bit-vector representating the set of dominators. See the - ;; function `compute-dominators' to know how to use it properly. + ;; 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% ;; Arbitrary data which could be necessary to keep during IR ;; processing. @@ -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 ;;;;