]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler.cfg.gvn.testing: some helper words for debugging CFGs directly
authorAlex Vondrak <ajvondrak@csupomona.edu>
Sat, 11 Aug 2012 05:53:30 +0000 (22:53 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 20 Sep 2012 00:28:13 +0000 (17:28 -0700)
extra/compiler/cfg/gvn/testing/testing.factor

index 6295c2943ac3be491ed2cad932e8533f96aa21ea..59fb78accb750de30972205ab93156224803306c 100644 (file)
@@ -1,11 +1,12 @@
 ! Copyright (C) 2011 Alex Vondrak.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs compiler.cfg compiler.cfg.graphviz
-compiler.cfg.gvn compiler.cfg.gvn.expressions
-compiler.cfg.gvn.graph compiler.cfg.optimizer continuations
-formatting graphviz graphviz.notation graphviz.render
-io.directories kernel math.parser namespaces prettyprint
-sequences sorting splitting tools.annotations ;
+USING: accessors assocs compiler.cfg compiler.cfg.debugger
+compiler.cfg.graphviz compiler.cfg.gvn
+compiler.cfg.gvn.expressions compiler.cfg.gvn.graph
+compiler.cfg.optimizer continuations formatting graphviz
+graphviz.notation graphviz.render io.directories kernel
+math.parser namespaces prettyprint sequences sorting splitting
+tools.annotations ;
 IN: compiler.cfg.gvn.testing
 
 GENERIC: expr>str ( expr -- str )
@@ -94,3 +95,13 @@ SYMBOL: iteration
 
 : watch-gvn ( path quot -- )
     annotate-gvn [ test-gvn ] [ reset-gvn ] [ ] cleanup ;
+
+: watch-gvn-cfg ( path cfg -- )
+    annotate-gvn [
+        { value-numbering } passes [
+            0 iteration [ watch-cfg ] with-variable
+        ] with-variable
+    ] [ reset-gvn ] [ ] cleanup ;
+
+: watch-gvn-bb ( path insns -- )
+    0 test-bb cfg new 0 get >>entry watch-gvn-cfg ;