]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/compiler/cfg/ssa/destruction/destruction-tests.factor
stomp.cli: simplify
[factor.git] / basis / compiler / cfg / ssa / destruction / destruction-tests.factor
index ce05ae4d289b840cd115908b5f59f6c1f7b3e32c..8ce0000baed0ba0084395e9b9bfd98debca8ec8e 100644 (file)
@@ -1,39 +1,40 @@
-USING: alien.syntax compiler.cfg.def-use compiler.cfg.instructions
-compiler.cfg.registers compiler.cfg.ssa.destruction
-compiler.cfg.ssa.destruction.leaders
+USING: alien.syntax compiler.cfg.instructions compiler.cfg.registers
+compiler.cfg.ssa.destruction compiler.cfg.ssa.destruction.leaders
 compiler.cfg.ssa.destruction.private compiler.cfg.utilities
-cpu.architecture cpu.x86.assembler.operands kernel make namespaces tools.test ;
+cpu.architecture cpu.x86.assembler.operands kernel make namespaces
+sequences tools.test ;
 IN: compiler.cfg.ssa.destruction.tests
 
-! cleanup-insn
-{
-    V{ T{ ##copy { src 45 } { dst 47 } { rep double-2-rep } } }
-} [
+: setup-leader/reps-scenario ( -- )
+    ! Note the differences in representation.
     H{ { 45 45 } { 46 45 } { 47 47 } { 100 47 } } leader-map set
-    ! how can the leader of a vreg have a different representation
-    ! than the vreg itself?
     H{
         { 45 double-2-rep }
         { 46 double-rep }
         { 47 double-rep }
         { 100 double-rep }
-    } representations set
-    T{ ##parallel-copy { values V{ { 100 46 } } } }
-    [ cleanup-insn ] V{ } make
-] unit-test
+    } representations set ;
 
-{ V{ } } [
-    T{ ##parallel-copy { values V{ } } }
-    [ cleanup-insn ] V{ } make
+! cleanup-insn
+{
+    V{ T{ ##copy { dst 100 } { src 46 } } }
+} [
+    setup-leader/reps-scenario
+    T{ ##copy { src 46 } { dst 100 } } [ cleanup-insn ] V{ } make
 ] unit-test
 
-! init-coalescing
+! I think the difference is because ##parallel-copy may encode a swap
+! between two vregs.
 {
-    H{ { 123 123 } { 77 77 } }
+    V{ T{ ##copy { dst 47 } { src 45 } { rep double-2-rep } } }
 } [
-    H{ { 123 "bb1" } { 77 "bb2" } } defs set
-    init-coalescing
-    leader-map get
+    setup-leader/reps-scenario
+    T{ ##parallel-copy { values V{ { 100 46 } } } } [ cleanup-insn ] V{ } make
+] unit-test
+
+{ V{ } } [
+    T{ ##parallel-copy { values V{ } } }
+    [ cleanup-insn ] V{ } make
 ] unit-test
 
 ! destruct-ssa
@@ -50,10 +51,10 @@ IN: compiler.cfg.ssa.destruction.tests
            { stack-size 0 }
            { symbols "g_quark_to_string" }
            { dll DLL" libglib-2.0.so" }
-           { gc-map T{ gc-map { scrub-d { } } { scrub-r { } } } }
+           { gc-map T{ gc-map } }
            { insn# 14 }
         }
-        T{ ##call-gc { gc-map T{ gc-map { scrub-d { } } { scrub-r { } } } } }
+        T{ ##call-gc { gc-map T{ gc-map } } }
         T{ ##box-alien
            { dst 37 }
            { src 36 }
@@ -62,21 +63,3 @@ IN: compiler.cfg.ssa.destruction.tests
         }
     } 0 insns>block block>cfg destruct-ssa
 ] unit-test
-
-! must-eliminate-copy
-{ } [
-    10 10 must-eliminate-copy
-] unit-test
-
-! prepare-insn
-{ V{ { 2 1 } } } [
-    V{ } clone copies set
-    T{ ##copy { src 1 } { dst 2 } { rep int-rep } } prepare-insn
-    copies get
-] unit-test
-
-{ V{ { 3 4 } { 7 8 } } } [
-    V{ } clone copies set
-    T{ ##parallel-copy { values V{ { 3 4 } { 7 8 } } } } prepare-insn
-    copies get
-] unit-test