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 } }
63 T{ ##replace { src 1 } { loc D 0 } }
69 replaces get height-state get emit-changes
74 D 3 { { 1 2 } { 3 4 } } translate-local-loc
81 D 3 inc-stack height-state get
87 { { 2 0 } { 0 0 } } height-state set
88 D 3 inc-stack height-state get
92 { T{ ##inc { loc D 4 } } T{ ##inc { loc R -2 } } }
94 { { 0 4 } { 0 -2 } } height-state>insns
97 { H{ { D -1 40 } } } [
98 D 1 inc-stack 40 D 0 replace-loc replaces get
102 V{ } 0 insns>block 0 0 pick record-stack-heights
103 compute-local-kill-set sets:cardinality
107 V{ } 0 insns>block 4 4 pick record-stack-heights
108 { { 8 0 } { 3 0 } } height-state set
109 compute-local-kill-set