]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/cfg/linear-scan/resolve/resolve-tests.factor
build: add a make clean target, delete overlooked factor binary in make clean
[factor.git] / basis / compiler / cfg / linear-scan / resolve / resolve-tests.factor
1 USING: accessors compiler.cfg compiler.cfg.instructions
2 compiler.cfg.linear-scan.resolve compiler.cfg.utilities
3 cpu.architecture kernel make namespaces sequences tools.test ;
4 IN: compiler.cfg.linear-scan.resolve.tests
5
6 {
7     {
8         {
9             T{ location f T{ spill-slot f 0 } int-rep int-regs }
10             T{ location f 1 int-rep int-regs }
11         }
12     }
13 } [
14     [
15         0 <spill-slot> 1 int-rep add-mapping
16     ] { } make
17 ] unit-test
18
19 {
20     {
21         T{ ##reload { dst 1 } { rep int-rep } { src T{ spill-slot f 0 } } }
22     }
23 } [
24     [
25         T{ location f T{ spill-slot f 0 } int-rep int-regs }
26         T{ location f 1 int-rep int-regs }
27         >insn
28     ] { } make
29 ] unit-test
30
31 {
32     {
33         T{ ##spill { src 1 } { rep int-rep } { dst T{ spill-slot f 0 } } }
34     }
35 } [
36     [
37         T{ location f 1 int-rep int-regs }
38         T{ location f T{ spill-slot f 0 } int-rep int-regs }
39         >insn
40     ] { } make
41 ] unit-test
42
43 {
44     {
45         T{ ##copy { src 1 } { dst 2 } { rep int-rep } }
46     }
47 } [
48     [
49         T{ location f 1 int-rep int-regs }
50         T{ location f 2 int-rep int-regs }
51         >insn
52     ] { } make
53 ] unit-test
54
55 {
56     {
57         T{ ##copy { src 1 } { dst 2 } { rep int-rep } }
58         T{ ##branch }
59     }
60 } [
61     { { T{ location f 1 int-rep int-regs } T{ location f 2 int-rep int-regs } } }
62     mapping-instructions
63 ] unit-test
64
65 {
66     {
67         T{ ##spill { src 0 } { rep int-rep } { dst T{ spill-slot f 0 } } }
68         T{ ##reload { dst 0 } { rep tagged-rep } { src T{ spill-slot f 1 } } }
69         T{ ##branch }
70     }
71 } [
72     {
73         { T{ location f T{ spill-slot f 1 } tagged-rep int-regs } T{ location f 0 tagged-rep int-regs } }
74         { T{ location f 0 int-rep int-regs } T{ location f T{ spill-slot f 0 } int-rep int-regs } }
75     }
76     mapping-instructions
77 ] unit-test
78
79 {
80     {
81         T{ ##spill { src 0 } { rep int-rep } { dst T{ spill-slot f 1 } } }
82         T{ ##reload { dst 0 } { rep tagged-rep } { src T{ spill-slot f 0 } } }
83         T{ ##branch }
84     }
85 } [
86     {
87         { T{ location f T{ spill-slot f 0 } tagged-rep int-regs } T{ location f 0 tagged-rep int-regs } }
88         { T{ location f 0 int-rep int-regs } T{ location f T{ spill-slot f 1 } int-rep int-regs } }
89     }
90     mapping-instructions
91 ] unit-test
92
93 {
94     {
95         T{ ##spill { src 0 } { rep int-rep } { dst T{ spill-slot f 1 } } }
96         T{ ##reload { dst 0 } { rep tagged-rep } { src T{ spill-slot f 0 } } }
97         T{ ##branch }
98     }
99 } [
100     {
101         { T{ location f 0 int-rep int-regs } T{ location f T{ spill-slot f 1 } int-rep int-regs } }
102         { T{ location f T{ spill-slot f 0 } tagged-rep int-regs } T{ location f 0 tagged-rep int-regs } }
103     }
104     mapping-instructions
105 ] unit-test
106
107 { } insns>cfg [ stack-frame>> 8 >>spill-area-size drop ] [ cfg set ] bi
108 init-resolve
109
110 { t } [
111     {
112         { T{ location f 0 int-rep int-regs } T{ location f 1 int-rep int-regs } }
113         { T{ location f 1 int-rep int-regs } T{ location f 0 int-rep int-regs } }
114     }
115     mapping-instructions {
116         {
117             T{ ##spill { src 0 } { rep int-rep } { dst T{ spill-slot f 8 } } }
118             T{ ##copy { dst 0 } { src 1 } { rep int-rep } }
119             T{ ##reload { dst 1 } { rep int-rep } { src T{ spill-slot f 8 } } }
120             T{ ##branch }
121         }
122         {
123             T{ ##spill { src 1 } { rep int-rep } { dst T{ spill-slot f 8 } } }
124             T{ ##copy { dst 1 } { src 0 } { rep int-rep } }
125             T{ ##reload { dst 0 } { rep int-rep } { src T{ spill-slot f 8 } } }
126             T{ ##branch }
127         }
128     } member?
129 ] unit-test