compiler.*: use block>cfg and insns>block in many tests instead of wordier code

db4
Björn Lindqvist 2014-11-07 19:02:14 +01:00 committed by Doug Coleman
parent c8a022423e
commit 96396cb3ad
21 changed files with 70 additions and 88 deletions

View File

@ -1,4 +1,4 @@
USING: accessors assocs compiler.cfg USING: accessors assocs compiler.cfg.utilities compiler.cfg
compiler.cfg.branch-splitting compiler.cfg.debugger compiler.cfg.branch-splitting compiler.cfg.debugger
compiler.cfg.predecessors compiler.cfg.rpo compiler.cfg.instructions fry kernel compiler.cfg.predecessors compiler.cfg.rpo compiler.cfg.instructions fry kernel
tools.test namespaces sequences vectors ; tools.test namespaces sequences vectors ;
@ -18,7 +18,7 @@ IN: compiler.cfg.branch-splitting.tests
check-predecessors ; check-predecessors ;
: test-branch-splitting ( -- ) : test-branch-splitting ( -- )
cfg new 0 get >>entry check-branch-splitting ; 0 get block>cfg check-branch-splitting ;
V{ T{ ##branch } } 0 test-bb V{ T{ ##branch } } 0 test-bb
@ -82,4 +82,4 @@ V{ T{ ##branch } } 2 test-bb
1 2 edge 1 2 edge
[ ] [ test-branch-splitting ] unit-test [ ] [ test-branch-splitting ] unit-test

View File

@ -1,11 +1,10 @@
USING: compiler.cfg.copy-prop tools.test namespaces kernel USING: accessors compiler.cfg compiler.cfg.copy-prop compiler.cfg.debugger
compiler.cfg.debugger compiler.cfg accessors compiler.cfg.instructions compiler.cfg.registers compiler.cfg.utilities
compiler.cfg.registers compiler.cfg.instructions cpu.architecture kernel namespaces tools.test ;
cpu.architecture ;
IN: compiler.cfg.copy-prop.tests IN: compiler.cfg.copy-prop.tests
: test-copy-propagation ( -- ) : test-copy-propagation ( -- )
cfg new 0 get >>entry copy-propagation drop ; 0 get block>cfg copy-propagation drop ;
! Simple example ! Simple example
V{ V{

View File

@ -1,14 +1,11 @@
! Copyright (C) 2009 Daniel Ehrenberg. ! Copyright (C) 2009 Daniel Ehrenberg.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: tools.test compiler.cfg kernel accessors compiler.cfg.dce USING: accessors kernel compiler.cfg compiler.cfg.dce compiler.cfg.instructions
compiler.cfg.instructions compiler.cfg.registers cpu.architecture ; compiler.cfg.registers compiler.cfg.utilities cpu.architecture tools.test ;
IN: compiler.cfg.dce.tests IN: compiler.cfg.dce.tests
: test-dce ( insns -- insns' ) : test-dce ( insns -- insns' )
<basic-block> swap >>instructions insns>cfg eliminate-dead-code entry>> instructions>> ;
cfg new swap >>entry
eliminate-dead-code
entry>> instructions>> ;
[ V{ [ V{
T{ ##load-integer { dst 1 } { val 8 } } T{ ##load-integer { dst 1 } { val 8 } }

View File

@ -100,8 +100,7 @@ M: rs-loc pprint* \ R pprint-loc ;
] each-phi ; ] each-phi ;
: test-bb ( insns n -- ) : test-bb ( insns n -- )
[ <basic-block> swap >>number swap >>instructions dup ] keep set [ insns>block dup ] keep set resolve-phis ;
resolve-phis ;
: edge ( from to -- ) : edge ( from to -- )
[ get ] bi@ 1vector >>successors drop ; [ get ] bi@ 1vector >>successors drop ;

View File

@ -1,13 +1,9 @@
! Copyright (C) 2009 Daniel Ehrenberg. ! Copyright (C) 2009 Daniel Ehrenberg.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel tools.test accessors vectors sequences namespaces USING: kernel tools.test accessors vectors sequences namespaces
arrays arrays compiler.cfg.def-use compiler.cfg compiler.cfg.debugger
cpu.architecture compiler.cfg.instructions compiler.cfg.registers compiler.cfg.utilities
compiler.cfg.def-use cpu.architecture ;
compiler.cfg
compiler.cfg.debugger
compiler.cfg.instructions
compiler.cfg.registers ;
IN: compiler.cfg.def-use.tests IN: compiler.cfg.def-use.tests
V{ V{
@ -32,5 +28,5 @@ V{
4 6 edge 4 6 edge
5 6 edge 5 6 edge
cfg new 1 get >>entry 0 set 1 get block>cfg 0 set
[ ] [ 0 get compute-defs ] unit-test [ ] [ 0 get compute-defs ] unit-test

View File

@ -1,11 +1,10 @@
USING: tools.test sequences vectors namespaces kernel accessors assocs sets USING: tools.test sequences vectors namespaces kernel accessors assocs sets
math.ranges arrays compiler.cfg compiler.cfg.dominance compiler.cfg.debugger math.ranges arrays compiler.cfg compiler.cfg.dominance compiler.cfg.debugger
compiler.cfg.predecessors ; compiler.cfg.predecessors compiler.cfg.utilities ;
IN: compiler.cfg.dominance.tests IN: compiler.cfg.dominance.tests
: test-dominance ( -- ) : test-dominance ( -- )
cfg new 0 get >>entry 0 get block>cfg needs-dominance drop ;
needs-dominance drop ;
! Example with no back edges ! Example with no back edges
V{ } 0 test-bb V{ } 0 test-bb

View File

@ -4,7 +4,7 @@ compiler.cfg.registers compiler.cfg.instructions compiler.cfg
compiler.cfg.predecessors compiler.cfg.rpo cpu.architecture compiler.cfg.predecessors compiler.cfg.rpo cpu.architecture
tools.test kernel vectors namespaces accessors sequences alien tools.test kernel vectors namespaces accessors sequences alien
memory classes make combinators.short-circuit byte-arrays memory classes make combinators.short-circuit byte-arrays
compiler.cfg.comparisons ; compiler.cfg.comparisons compiler.cfg.utilities ;
IN: compiler.cfg.gc-checks.tests IN: compiler.cfg.gc-checks.tests
[ { } ] [ [ { } ] [
@ -84,7 +84,7 @@ IN: compiler.cfg.gc-checks.tests
: test-gc-checks ( -- ) : test-gc-checks ( -- )
H{ } clone representations set H{ } clone representations set
cfg new 0 get >>entry cfg set ; 0 get block>cfg cfg set ;
V{ V{
T{ ##inc-d f 3 } T{ ##inc-d f 3 }

View File

@ -77,7 +77,7 @@ M: ##box-displaced-alien allocation-size* drop 5 cells ;
] each ; ] each ;
: make-blocks ( insns-seq -- bbs ) : make-blocks ( insns-seq -- bbs )
[ <basic-block> swap >>instructions ] map ; [ f insns>block ] map ;
: <gc-call> ( -- bb ) : <gc-call> ( -- bb )
<basic-block> <basic-block>

View File

@ -19,7 +19,8 @@ compiler.cfg.linear-scan.allocation
compiler.cfg.linear-scan.allocation.state compiler.cfg.linear-scan.allocation.state
compiler.cfg.linear-scan.allocation.splitting compiler.cfg.linear-scan.allocation.splitting
compiler.cfg.linear-scan.allocation.spilling compiler.cfg.linear-scan.allocation.spilling
compiler.cfg.linear-scan.debugger ; compiler.cfg.linear-scan.debugger
compiler.cfg.utilities ;
FROM: namespaces => set ; FROM: namespaces => set ;
IN: compiler.cfg.linear-scan.tests IN: compiler.cfg.linear-scan.tests
@ -37,7 +38,7 @@ V{
} 0 test-bb } 0 test-bb
: test-live-intervals ( -- ) : test-live-intervals ( -- )
cfg new 0 get >>entry 0 get block>cfg
[ cfg set ] [ number-instructions ] [ compute-live-intervals ] tri [ cfg set ] [ number-instructions ] [ compute-live-intervals ] tri
2drop ; 2drop ;

View File

@ -1,5 +1,5 @@
USING: compiler.cfg.debugger compiler.cfg compiler.cfg.linearization USING: compiler.cfg.debugger compiler.cfg compiler.cfg.linearization
kernel accessors sequences sets tools.test namespaces ; compiler.cfg.utilities kernel accessors sequences sets tools.test namespaces ;
IN: compiler.cfg.linearization.tests IN: compiler.cfg.linearization.tests
V{ } 0 test-bb V{ } 0 test-bb
@ -11,4 +11,4 @@ V{ } 2 test-bb
0 { 1 1 } edges 0 { 1 1 } edges
1 2 edge 1 2 edge
[ t ] [ cfg new 0 get >>entry linearization-order [ id>> ] map all-unique? ] unit-test [ t ] [ 0 get block>cfg linearization-order [ id>> ] map all-unique? ] unit-test

View File

@ -1,14 +1,13 @@
USING: compiler.cfg.liveness USING: compiler.cfg.liveness
compiler.cfg.debugger compiler.cfg.instructions compiler.cfg compiler.cfg.debugger compiler.cfg.instructions
compiler.cfg.predecessors compiler.cfg.registers compiler.cfg compiler.cfg.predecessors compiler.cfg.registers compiler.cfg.utilities
cpu.architecture accessors namespaces sequences kernel cpu.architecture accessors namespaces sequences kernel
tools.test vectors alien math compiler.cfg.comparisons tools.test vectors alien math compiler.cfg.comparisons
cpu.x86.assembler.operands assocs ; cpu.x86.assembler.operands assocs ;
IN: compiler.cfg.liveness.tests IN: compiler.cfg.liveness.tests
: test-liveness ( -- ) : test-liveness ( -- )
cfg new 1 get >>entry 1 get block>cfg compute-live-sets ;
compute-live-sets ;
! Sanity check... ! Sanity check...
@ -197,7 +196,7 @@ V{
5 6 edge 5 6 edge
6 7 edge 6 7 edge
[ ] [ cfg new 0 get >>entry dup cfg set compute-live-sets ] unit-test [ ] [ 0 get block>cfg dup cfg set compute-live-sets ] unit-test
[ t ] [ 0 get live-in assoc-empty? ] unit-test [ t ] [ 0 get live-in assoc-empty? ] unit-test
@ -236,7 +235,7 @@ H{
{ 1 int-rep } { 1 int-rep }
} representations set } representations set
[ ] [ cfg new 0 get >>entry dup cfg set compute-live-sets ] unit-test [ ] [ 0 get block>cfg dup cfg set compute-live-sets ] unit-test
[ V{ { 1 0 } } ] [ 1 get instructions>> 2 swap nth gc-map>> derived-roots>> ] unit-test [ V{ { 1 0 } } ] [ 1 get instructions>> 2 swap nth gc-map>> derived-roots>> ] unit-test
@ -244,4 +243,4 @@ H{
[ V{ { 1 0 } } ] [ 1 get instructions>> 4 swap nth gc-map>> derived-roots>> ] unit-test [ V{ { 1 0 } } ] [ 1 get instructions>> 4 swap nth gc-map>> derived-roots>> ] unit-test
[ { 0 } ] [ 1 get instructions>> 4 swap nth gc-map>> gc-roots>> ] unit-test [ { 0 } ] [ 1 get instructions>> 4 swap nth gc-map>> gc-roots>> ] unit-test

View File

@ -1,7 +1,6 @@
USING: compiler.cfg compiler.cfg.loop-detection USING: compiler.cfg compiler.cfg.loop-detection compiler.cfg.debugger
compiler.cfg.predecessors compiler.cfg.predecessors compiler.cfg.utilities tools.test kernel namespaces
compiler.cfg.debugger accessors ;
tools.test kernel namespaces accessors ;
IN: compiler.cfg.loop-detection.tests IN: compiler.cfg.loop-detection.tests
V{ } 0 test-bb V{ } 0 test-bb
@ -11,7 +10,8 @@ V{ } 2 test-bb
0 { 1 2 } edges 0 { 1 2 } edges
2 0 edge 2 0 edge
: test-loop-detection ( -- ) cfg new 0 get >>entry needs-loops drop ; : test-loop-detection ( -- )
0 get block>cfg needs-loops drop ;
[ ] [ test-loop-detection ] unit-test [ ] [ test-loop-detection ] unit-test

View File

@ -3,11 +3,12 @@ compiler.cfg.instructions
compiler.cfg.registers compiler.cfg.registers
compiler.cfg.debugger compiler.cfg.debugger
compiler.cfg.representations.coalescing compiler.cfg.representations.coalescing
compiler.cfg.utilities
tools.test ; tools.test ;
IN: compiler.cfg.representations.coalescing.tests IN: compiler.cfg.representations.coalescing.tests
: test-scc ( -- ) : test-scc ( -- )
cfg new 0 get >>entry compute-components ; 0 get block>cfg compute-components ;
V{ V{
T{ ##prologue } T{ ##prologue }

View File

@ -4,7 +4,7 @@ compiler.cfg.representations.preferred cpu.architecture kernel
namespaces tools.test sequences arrays system literals layouts namespaces tools.test sequences arrays system literals layouts
math compiler.constants compiler.cfg.representations.conversion math compiler.constants compiler.cfg.representations.conversion
compiler.cfg.representations.rewrite compiler.cfg.representations.rewrite
compiler.cfg.comparisons compiler.cfg.comparisons compiler.cfg.utilities
make ; make ;
FROM: alien.c-types => char ; FROM: alien.c-types => char ;
IN: compiler.cfg.representations IN: compiler.cfg.representations
@ -52,7 +52,7 @@ H{ } clone representations set
] unit-test ] unit-test
: test-representations ( -- ) : test-representations ( -- )
cfg new 0 get >>entry dup cfg set select-representations drop ; 0 get block>cfg dup cfg set select-representations drop ;
! Make sure cost calculation isn't completely wrong ! Make sure cost calculation isn't completely wrong
V{ V{

View File

@ -1,7 +1,8 @@
USING: accessors compiler.cfg compiler.cfg.debugger USING: accessors compiler.cfg compiler.cfg.debugger
compiler.cfg.dominance compiler.cfg.instructions compiler.cfg.dominance compiler.cfg.instructions
compiler.cfg.predecessors compiler.cfg.ssa.construction assocs compiler.cfg.predecessors compiler.cfg.ssa.construction assocs
compiler.cfg.registers cpu.architecture kernel namespaces sequences compiler.cfg.registers compiler.cfg.utilities cpu.architecture kernel
namespaces sequences
tools.test vectors ; tools.test vectors ;
IN: compiler.cfg.ssa.construction.tests IN: compiler.cfg.ssa.construction.tests
@ -11,7 +12,7 @@ IN: compiler.cfg.ssa.construction.tests
0 basic-block set-global ; 0 basic-block set-global ;
: test-ssa ( -- ) : test-ssa ( -- )
cfg new 0 get >>entry 0 get block>cfg
dup cfg set dup cfg set
construct-ssa construct-ssa
drop ; drop ;
@ -197,4 +198,4 @@ V{
[ V{ } ] [ 5 get instructions>> [ ##phi? ] filter ] unit-test [ V{ } ] [ 5 get instructions>> [ ##phi? ] filter ] unit-test
[ V{ } ] [ 7 get instructions>> [ ##phi? ] filter ] unit-test [ V{ } ] [ 7 get instructions>> [ ##phi? ] filter ] unit-test

View File

@ -1,12 +1,12 @@
USING: accessors arrays compiler.cfg compiler.cfg.debugger USING: accessors arrays compiler.cfg compiler.cfg.debugger
compiler.cfg.dominance compiler.cfg.predecessors compiler.cfg.dominance compiler.cfg.predecessors
compiler.cfg.ssa.construction.tdmsc kernel namespaces sequences compiler.cfg.ssa.construction.tdmsc compiler.cfg.utilities kernel namespaces
tools.test vectors sets ; sequences sets tools.test vectors ;
FROM: namespaces => set ; FROM: namespaces => set ;
IN: compiler.cfg.ssa.construction.tdmsc.tests IN: compiler.cfg.ssa.construction.tdmsc.tests
: test-tdmsc ( -- ) : test-tdmsc ( -- )
cfg new 0 get >>entry dup cfg set 0 get block>cfg dup cfg set
compute-merge-sets ; compute-merge-sets ;
V{ } 0 test-bb V{ } 0 test-bb

View File

@ -5,12 +5,13 @@ compiler.cfg.registers compiler.cfg.predecessors
compiler.cfg.comparisons compiler.cfg.ssa.interference compiler.cfg.comparisons compiler.cfg.ssa.interference
compiler.cfg.ssa.interference.private compiler.cfg.ssa.interference.private
compiler.cfg.ssa.interference.live-ranges compiler.cfg.ssa.interference.live-ranges
compiler.cfg.utilities
cpu.architecture kernel namespaces tools.test alien.c-types cpu.architecture kernel namespaces tools.test alien.c-types
arrays sequences slots ; arrays sequences slots ;
IN: compiler.cfg.ssa.interference.tests IN: compiler.cfg.ssa.interference.tests
: test-interference ( -- ) : test-interference ( -- )
cfg new 0 get >>entry 0 get block>cfg
dup compute-live-sets dup compute-live-sets
dup compute-defs dup compute-defs
dup compute-insns dup compute-insns
@ -358,4 +359,4 @@ V{
[ f ] [ 33 21 test-vregs-intersect? ] unit-test [ f ] [ 33 21 test-vregs-intersect? ] unit-test
[ f ] [ 32 21 test-vregs-intersect? ] unit-test [ f ] [ 32 21 test-vregs-intersect? ] unit-test
[ f ] [ 32 33 test-vregs-intersect? ] unit-test [ f ] [ 32 33 test-vregs-intersect? ] unit-test

View File

@ -3,8 +3,8 @@ compiler.cfg.registers compiler.cfg.debugger compiler.cfg.comparisons
cpu.architecture tools.test kernel math combinators.short-circuit cpu.architecture tools.test kernel math combinators.short-circuit
accessors sequences compiler.cfg.predecessors locals compiler.cfg.dce accessors sequences compiler.cfg.predecessors locals compiler.cfg.dce
compiler.cfg.ssa.destruction compiler.cfg.loop-detection compiler.cfg.ssa.destruction compiler.cfg.loop-detection
compiler.cfg.representations compiler.cfg assocs vectors arrays compiler.cfg.representations compiler.cfg compiler.cfg.utilities assocs vectors
layouts literals namespaces alien compiler.cfg.value-numbering.simd arrays layouts literals namespaces alien compiler.cfg.value-numbering.simd
system ; system ;
QUALIFIED-WITH: alien.c-types c QUALIFIED-WITH: alien.c-types c
IN: compiler.cfg.value-numbering.tests IN: compiler.cfg.value-numbering.tests
@ -1245,7 +1245,7 @@ cpu x86? [
T{ ##compare-integer-imm f 1 0 0 cc<= } T{ ##compare-integer-imm f 1 0 0 cc<= }
} value-numbering-step } value-numbering-step
] unit-test ] unit-test
[ [
{ {
T{ ##peek f 0 D 0 } T{ ##peek f 0 D 0 }
@ -2747,7 +2747,7 @@ V{
test-diamond test-diamond
[ ] [ [ ] [
cfg new 0 get >>entry dup cfg set 0 get block>cfg dup cfg set
value-numbering value-numbering
select-representations select-representations
destruct-ssa drop destruct-ssa drop
@ -2787,7 +2787,7 @@ V{
test-diamond test-diamond
[ ] [ [ ] [
cfg new 0 get >>entry 0 get block>cfg
value-numbering value-numbering
eliminate-dead-code eliminate-dead-code
drop drop
@ -2856,7 +2856,7 @@ V{
4 5 edge 4 5 edge
[ ] [ [ ] [
cfg new 0 get >>entry 0 get block>cfg
value-numbering eliminate-dead-code drop value-numbering eliminate-dead-code drop
] unit-test ] unit-test

View File

@ -2,8 +2,8 @@ USING: accessors assocs compiler compiler.cfg
compiler.cfg.debugger compiler.cfg.instructions compiler.cfg.debugger compiler.cfg.instructions
compiler.cfg.registers compiler.cfg.linear-scan compiler.cfg.registers compiler.cfg.linear-scan
compiler.cfg.ssa.destruction compiler.cfg.build-stack-frame compiler.cfg.ssa.destruction compiler.cfg.build-stack-frame
compiler.codegen compiler.units cpu.architecture hashtables compiler.cfg.utilities compiler.codegen compiler.units cpu.architecture
kernel namespaces sequences tools.test vectors words layouts hashtables kernel namespaces sequences tools.test vectors words layouts
literals math arrays alien.c-types alien.syntax math.private ; literals math arrays alien.c-types alien.syntax math.private ;
IN: compiler.tests.low-level-ir IN: compiler.tests.low-level-ir
@ -13,7 +13,7 @@ IN: compiler.tests.low-level-ir
[ associate >alist t t modify-code-heap ] keep ; [ associate >alist t t modify-code-heap ] keep ;
: compile-test-cfg ( -- word ) : compile-test-cfg ( -- word )
cfg new 0 get >>entry 0 get block>cfg
dup cfg set dup cfg set
dup fake-representations dup fake-representations
destruct-ssa destruct-ssa

View File

@ -2,11 +2,10 @@ USING: compiler.cfg.gvn compiler.cfg.instructions
compiler.cfg.registers compiler.cfg.debugger compiler.cfg.registers compiler.cfg.debugger
compiler.cfg.comparisons cpu.architecture tools.test kernel compiler.cfg.comparisons cpu.architecture tools.test kernel
math combinators.short-circuit accessors sequences math combinators.short-circuit accessors sequences
compiler.cfg.predecessors locals compiler.cfg.dce compiler.cfg.predecessors compiler.cfg.utilities locals compiler.cfg.dce
compiler.cfg.ssa.destruction compiler.cfg.loop-detection compiler.cfg.ssa.destruction compiler.cfg.loop-detection
compiler.cfg.representations compiler.cfg assocs vectors arrays compiler.cfg.representations compiler.cfg assocs vectors arrays
layouts literals namespaces alien compiler.cfg.gvn.simd system layouts literals namespaces alien compiler.cfg.gvn.simd system ;
;
QUALIFIED-WITH: alien.c-types c QUALIFIED-WITH: alien.c-types c
IN: compiler.cfg.gvn.tests IN: compiler.cfg.gvn.tests
@ -28,7 +27,7 @@ IN: compiler.cfg.gvn.tests
: value-number-bb ( insns -- insns' ) : value-number-bb ( insns -- insns' )
0 test-bb 0 test-bb
cfg new 0 get >>entry 0 get block>cfg
value-numbering drop value-numbering drop
0 get instructions>> ; 0 get instructions>> ;
@ -2616,7 +2615,7 @@ cell 8 = [
V{ } 1 test-bb V{ } 1 test-bb
V{ } 2 test-bb V{ } 2 test-bb
0 { 1 2 } edges 0 { 1 2 } edges
cfg new 0 get >>entry 0 get block>cfg
value-numbering drop value-numbering drop
0 get [ instructions>> ] [ successors>> first number>> 1 - ] bi ; 0 get [ instructions>> ] [ successors>> first number>> 1 - ] bi ;
@ -2800,7 +2799,7 @@ V{
test-diamond test-diamond
[ ] [ [ ] [
cfg new 0 get >>entry dup cfg set 0 get block>cfg dup cfg set
value-numbering value-numbering
select-representations select-representations
destruct-ssa drop destruct-ssa drop
@ -2839,11 +2838,7 @@ V{
test-diamond test-diamond
[ ] [ [ ] [ 0 get block>cfg value-numbering drop ] unit-test
cfg new 0 get >>entry
value-numbering
drop
] unit-test
[ t ] [ 1 get successors>> first 3 get eq? ] unit-test [ t ] [ 1 get successors>> first 3 get eq? ] unit-test
@ -2908,7 +2903,7 @@ V{
4 5 edge 4 5 edge
[ ] [ [ ] [
cfg new 0 get >>entry 0 get block>cfg
value-numbering eliminate-dead-code drop value-numbering eliminate-dead-code drop
] unit-test ] unit-test
@ -3183,10 +3178,7 @@ V{
test-diamond test-diamond
[ ] [ [ ] [ 0 get block>cfg value-numbering drop ] unit-test
cfg new 0 get >>entry
value-numbering drop
] unit-test
! First ##load-integer cannot be turned into a ##copy because ! First ##load-integer cannot be turned into a ##copy because
! the canonical leader for the value 100 is unavailable, but ! the canonical leader for the value 100 is unavailable, but
@ -3246,10 +3238,7 @@ V{ T{ ##epilogue } T{ ##return } } 5 test-bb
3 2 edge 3 2 edge
4 5 edge 4 5 edge
[ ] [ [ ] [ 0 get block>cfg value-numbering eliminate-dead-code drop ] unit-test
cfg new 0 get >>entry
value-numbering eliminate-dead-code drop
] unit-test
[ 1 ] [ 1 get instructions>> [ ##load-integer? ] count ] unit-test [ 1 ] [ 1 get instructions>> [ ##load-integer? ] count ] unit-test
[ 1 ] [ 2 get instructions>> [ ##phi? ] count ] unit-test [ 1 ] [ 2 get instructions>> [ ##phi? ] count ] unit-test

View File

@ -3,7 +3,7 @@
USING: accessors assocs compiler.cfg compiler.cfg.debugger USING: accessors assocs compiler.cfg compiler.cfg.debugger
compiler.cfg.graphviz compiler.cfg.gvn compiler.cfg.graphviz compiler.cfg.gvn
compiler.cfg.gvn.expressions compiler.cfg.gvn.graph compiler.cfg.gvn.expressions compiler.cfg.gvn.graph
compiler.cfg.optimizer continuations formatting graphviz compiler.cfg.optimizer compiler.cfg.utilities continuations formatting graphviz
graphviz.notation graphviz.render io.directories kernel graphviz.notation graphviz.render io.directories kernel
math.parser namespaces prettyprint sequences sorting splitting math.parser namespaces prettyprint sequences sorting splitting
tools.annotations ; tools.annotations ;
@ -104,4 +104,4 @@ SYMBOL: iteration
] [ reset-gvn ] [ ] cleanup ; ] [ reset-gvn ] [ ] cleanup ;
: watch-gvn-bb ( path insns -- ) : watch-gvn-bb ( path insns -- )
0 test-bb cfg new 0 get >>entry watch-gvn-cfg ; 0 test-bb 0 get block>cfg watch-gvn-cfg ;