Fix ir-complete
authorDavid Vázquez <davazp@gmail.com>
Sun, 12 May 2013 13:58:47 +0000 (14:58 +0100)
committerDavid Vázquez <davazp@gmail.com>
Sun, 12 May 2013 13:58:47 +0000 (14:58 +0100)
experimental/compiler.lisp

index 30e8d4a..388157f 100644 (file)
   `(dolist (,block (component-blocks ,component) ,result)
      ,@body))
 
+(defmacro do-blocks-backward ((block component &optional result) &body body)
+  `(dolist (,block (reverse (component-blocks ,component)) ,result)
+     ,@body))
+
+
 ;;; A few consistency checks in the IR useful for catching bugs.
 (defun check-ir-consistency (component)
   (with-simple-restart (continue "Continue execution")
         t))))
 
 (defun ir-complete (&optional (component *component*))
-  (do-blocks (block component)
+  (do-blocks-backward (block component)
     (maybe-coalesce-block block)
     (when (empty-block-p block)
       (delete-empty-block block))))