1 USING: accessors assocs biassocs combinators compiler.cfg
2 compiler.cfg.instructions compiler.cfg.registers compiler.cfg.stacks
3 compiler.cfg.stacks.height compiler.cfg.stacks.local compiler.cfg.utilities
4 compiler.test cpu.architecture make namespaces kernel tools.test ;
6 IN: compiler.cfg.stacks.local.tests
16 T{ ##copy { dst 1 } { src 25 } { rep any-rep } }
17 T{ ##copy { dst 2 } { src 26 } { rep any-rep } }
20 { { D 0 25 } { R 0 26 } } replaces>copy-insns
36 [ 0 0 rot record-stack-heights ]
37 [ [ "eh" , end-local-analysis ] V{ } make drop ]
38 [ [ peek-sets ] [ replace-sets ] [ kill-sets ] tri [ get at ] 2tri@ ] tri
45 [ 0 0 rot record-stack-heights ]
46 [ [ 3 D 3 replace-loc "eh" , end-local-analysis ] V{ } make drop ]
47 [ replace-sets get at ] tri
50 ! remove-redundant-replaces
52 H{ { T{ ds-loc { n 3 } } 7 } }
54 D 0 loc>vreg D 2 loc>vreg 2drop
55 2 D 2 replace-loc 7 D 3 replace-loc
56 replaces get remove-redundant-replaces
62 T{ ##copy { dst 1 } { src 3 } { rep any-rep } }
68 replaces get height-state get emit-changes
72 ! compute-local-kill-set
74 V{ } 0 insns>block 0 0 pick record-stack-heights
75 compute-local-kill-set sets:cardinality
79 V{ } 0 insns>block 4 4 pick record-stack-heights
80 { { 8 0 } { 3 0 } } height-state set
81 compute-local-kill-set
85 V{ } 0 insns>block [ 2 0 rot record-stack-heights ] keep
86 { { 0 0 } { 0 0 } } height-state set
87 compute-local-kill-set
92 D 3 { { 1 2 } { 3 4 } } translate-local-loc
99 D 3 inc-stack height-state get
105 { { 2 0 } { 0 0 } } height-state set
106 D 3 inc-stack height-state get
110 { T{ ##inc { loc D 4 } } T{ ##inc { loc R -2 } } }
112 { { 0 4 } { 0 -2 } } height-state>insns
115 { H{ { D -1 40 } } } [
116 D 1 inc-stack 40 D 0 replace-loc replaces get