]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/cfg/ssa/destruction/destruction-tests.factor
Fixes #2966
[factor.git] / basis / compiler / cfg / ssa / destruction / destruction-tests.factor
1 USING: alien.syntax compiler.cfg.instructions compiler.cfg.registers
2 compiler.cfg.ssa.destruction compiler.cfg.ssa.destruction.leaders
3 compiler.cfg.ssa.destruction.private compiler.cfg.utilities
4 cpu.architecture cpu.x86.assembler.operands kernel make namespaces
5 sequences tools.test ;
6 IN: compiler.cfg.ssa.destruction.tests
7
8 : setup-leader/reps-scenario ( -- )
9     ! Note the differences in representation.
10     H{ { 45 45 } { 46 45 } { 47 47 } { 100 47 } } leader-map set
11     H{
12         { 45 double-2-rep }
13         { 46 double-rep }
14         { 47 double-rep }
15         { 100 double-rep }
16     } representations set ;
17
18 ! cleanup-insn
19 {
20     V{ T{ ##copy { dst 100 } { src 46 } } }
21 } [
22     setup-leader/reps-scenario
23     T{ ##copy { src 46 } { dst 100 } } [ cleanup-insn ] V{ } make
24 ] unit-test
25
26 ! I think the difference is because ##parallel-copy may encode a swap
27 ! between two vregs.
28 {
29     V{ T{ ##copy { dst 47 } { src 45 } { rep double-2-rep } } }
30 } [
31     setup-leader/reps-scenario
32     T{ ##parallel-copy { values V{ { 100 46 } } } } [ cleanup-insn ] V{ } make
33 ] unit-test
34
35 { V{ } } [
36     T{ ##parallel-copy { values V{ } } }
37     [ cleanup-insn ] V{ } make
38 ] unit-test
39
40 ! destruct-ssa
41 { } [
42     H{ { 36 23 } { 23 23 } } leader-map set
43     H{ { 36 int-rep } { 37 tagged-rep } } representations set
44     V{
45         T{ ##alien-invoke
46            { reg-inputs V{ { 56 int-rep RDI } } }
47            { stack-inputs V{ } }
48            { reg-outputs { { 36 int-rep RAX } } }
49            { dead-outputs { } }
50            { cleanup 0 }
51            { stack-size 0 }
52            { symbols "g_quark_to_string" }
53            { dll DLL" libglib-2.0.so" }
54            { gc-map T{ gc-map } }
55            { insn# 14 }
56         }
57         T{ ##call-gc { gc-map T{ gc-map } } }
58         T{ ##box-alien
59            { dst 37 }
60            { src 36 }
61            { temp 11 }
62            { insn# 18 }
63         }
64     } 0 insns>block block>cfg destruct-ssa
65 ] unit-test