]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/cfg/ssa/destruction/destruction-tests.factor
compiler.cfg.ssa.destruction.tests: a bunch of new tests
[factor.git] / basis / compiler / cfg / ssa / destruction / destruction-tests.factor
1 USING: alien.syntax compiler.cfg.def-use compiler.cfg.instructions
2 compiler.cfg.registers compiler.cfg.ssa.destruction
3 compiler.cfg.ssa.destruction.leaders
4 compiler.cfg.ssa.destruction.private compiler.cfg.utilities
5 cpu.architecture cpu.x86.assembler.operands kernel make namespaces tools.test ;
6 IN: compiler.cfg.ssa.destruction.tests
7
8 ! cleanup-insn
9 {
10     V{ T{ ##copy { src 45 } { dst 47 } { rep double-2-rep } } }
11 } [
12     H{ { 45 45 } { 46 45 } { 47 47 } { 100 47 } } leader-map set
13     ! how can the leader of a vreg have a different representation
14     ! than the vreg itself?
15     H{
16         { 45 double-2-rep }
17         { 46 double-rep }
18         { 47 double-rep }
19         { 100 double-rep }
20     } representations set
21     T{ ##parallel-copy { values V{ { 100 46 } } } }
22     [ cleanup-insn ] V{ } make
23 ] unit-test
24
25 { V{ } } [
26     T{ ##parallel-copy { values V{ } } }
27     [ cleanup-insn ] V{ } make
28 ] unit-test
29
30 ! init-coalescing
31 {
32     H{ { 123 123 } { 77 77 } }
33 } [
34     H{ { 123 "bb1" } { 77 "bb2" } } defs set
35     init-coalescing
36     leader-map get
37 ] unit-test
38
39 ! destruct-ssa
40 { } [
41     H{ { 36 23 } { 23 23 } } leader-map set
42     H{ { 36 int-rep } { 37 tagged-rep } } representations set
43     V{
44         T{ ##alien-invoke
45            { reg-inputs V{ { 56 int-rep RDI } } }
46            { stack-inputs V{ } }
47            { reg-outputs { { 36 int-rep RAX } } }
48            { dead-outputs { } }
49            { cleanup 0 }
50            { stack-size 0 }
51            { symbols "g_quark_to_string" }
52            { dll DLL" libglib-2.0.so" }
53            { gc-map T{ gc-map { scrub-d { } } { scrub-r { } } } }
54            { insn# 14 }
55         }
56         T{ ##call-gc { gc-map T{ gc-map { scrub-d { } } { scrub-r { } } } } }
57         T{ ##box-alien
58            { dst 37 }
59            { src 36 }
60            { temp 11 }
61            { insn# 18 }
62         }
63     } 0 insns>block block>cfg destruct-ssa
64 ] unit-test
65
66 ! must-eliminate-copy
67 { } [
68     10 10 must-eliminate-copy
69 ] unit-test
70
71 ! prepare-insn
72 { V{ { 2 1 } } } [
73     V{ } clone copies set
74     T{ ##copy { src 1 } { dst 2 } { rep int-rep } } prepare-insn
75     copies get
76 ] unit-test
77
78 { V{ { 3 4 } { 7 8 } } } [
79     V{ } clone copies set
80     T{ ##parallel-copy { values V{ { 3 4 } { 7 8 } } } } prepare-insn
81     copies get
82 ] unit-test