compiler.cfg.gvn: move crappy test code to compiler.cfg.gvn.testing

db4
Alex Vondrak 2011-06-04 13:26:38 -07:00 committed by John Benediktsson
parent 4008edfdf8
commit 0e7fb629f5
8 changed files with 55 additions and 61 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@ -86,64 +86,3 @@ M: array process-instruction
dup [ init-value-graph [ process-instruction ] map flatten ] simple-optimization
cfg-changed predecessors-changed ;
USING: io math math.private prettyprint tools.annotations
compiler.cfg.debugger
compiler.cfg.graphviz
compiler.cfg.tco
compiler.cfg.useless-conditionals
compiler.cfg.branch-splitting
compiler.cfg.block-joining
compiler.cfg.height
compiler.cfg.ssa.construction
compiler.cfg.alias-analysis
compiler.cfg.copy-prop
compiler.cfg.dce
compiler.cfg.finalization ;
SYMBOL: gvn-test
[ 0 100 [ 1 fixnum+fast ] times ]
test-builder first [
optimize-tail-calls
delete-useless-conditionals
split-branches
join-blocks
normalize-height
construct-ssa
alias-analysis
] with-cfg gvn-test set-global
: watch-gvn ( -- )
\ value-numbering-step
[
'[
_ call
"Basic block #" write basic-block get number>> .
"vregs>gvns: " write vregs>gvns get .
"vregs>vns: " write vregs>vns get .
"exprs>vns: " write exprs>vns get .
"vns>insns: " write vns>insns get .
"\n---\n" print
]
] annotate ;
: reset-gvn ( -- )
\ value-numbering-step reset ;
: test-gvn ( -- )
watch-gvn
gvn-test get-global [
dup "Before GVN" "1" (cfgviz)
value-numbering
dup "After GVN" "2" (cfgviz)
copy-propagation
dup "After CP" "3" (cfgviz)
eliminate-dead-code
dup "After DCE" "4" (cfgviz)
finalize-cfg
dup "Final CFG" "5" (cfgviz)
drop
] with-cfg
reset-gvn ;

View File

@ -0,0 +1 @@
Alex Vondrak

View File

@ -0,0 +1,54 @@
! Copyright (C) 2011 Alex Vondrak.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors compiler.cfg compiler.cfg.alias-analysis
compiler.cfg.block-joining compiler.cfg.branch-splitting
compiler.cfg.copy-prop compiler.cfg.dce compiler.cfg.debugger
compiler.cfg.finalization compiler.cfg.graphviz
compiler.cfg.gvn compiler.cfg.gvn.graph compiler.cfg.height
compiler.cfg.ssa.construction compiler.cfg.tco
compiler.cfg.useless-conditionals fry io kernel math
math.private namespaces prettyprint sequences tools.annotations
;
IN: compiler.cfg.gvn.testing
SYMBOL: gvn-test
[ 0 100 [ 1 fixnum+fast ] times ]
test-builder first [
optimize-tail-calls
delete-useless-conditionals
split-branches
join-blocks
normalize-height
construct-ssa
alias-analysis
] with-cfg gvn-test set-global
: watch-gvn ( -- )
\ value-numbering-step
[
'[
_ call
"Basic block #" write basic-block get number>> .
"vregs>gvns: " write vregs>gvns get .
"vregs>vns: " write vregs>vns get .
"exprs>vns: " write exprs>vns get .
"vns>insns: " write vns>insns get .
"\n---\n" print
]
] annotate ;
: reset-gvn ( -- )
\ value-numbering-step reset ;
: test-gvn ( -- )
watch-gvn
gvn-test get-global [
{
value-numbering
copy-propagation
eliminate-dead-code
finalize-cfg
} [ watch-pass ] each-index drop
] with-cfg
reset-gvn ;