]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler.cfg.two-operand: if last instruction in a basic block is an overflowing...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 2 Aug 2009 04:50:47 +0000 (23:50 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 2 Aug 2009 04:50:47 +0000 (23:50 -0500)
basis/compiler/cfg/two-operand/two-operand-tests.factor
basis/compiler/cfg/two-operand/two-operand.factor

index 0d0c57e0f736d87342e4779ed76c3c4305c9e070..0717f1c536238621b861ec3ca1925971b3ac2564 100644 (file)
@@ -27,19 +27,12 @@ compiler.cfg.registers cpu.architecture namespaces tools.test ;
 
 [
     V{
-        T{ ##copy f V int-regs 4 V int-regs 2 }
-        T{ ##sub f V int-regs 4 V int-regs 4 V int-regs 1 }
-        T{ ##copy f V int-regs 1 V int-regs 4 }
+        T{ ##copy f V int-regs 4 V int-regs 1 }
+        T{ ##copy f V int-regs 1 V int-regs 2 }
+        T{ ##sub f V int-regs 1 V int-regs 1 V int-regs 4 }
     }
 ] [
     {
         T{ ##sub f V int-regs 1 V int-regs 2 V int-regs 1 }
     } (convert-two-operand)
 ] unit-test
-
-! This should never come up after coalescing
-[
-    V{
-        T{ ##fixnum-add f V int-regs 2 V int-regs 4 V int-regs 2 }
-    } (convert-two-operand)
-] must-fail
index db3462bf0df8f10d8adb614a687255fb68914941..35085855524bb98f58b402369590b8d6a31580c4 100644 (file)
@@ -65,15 +65,11 @@ GENERIC: convert-two-operand* ( insn -- )
 
 : case-2? ( insn -- ? ) [ dst>> ] [ src2>> ] bi = ; inline
 
-ERROR: bad-case-2 insn ;
-
 : case-2 ( insn -- )
-    ! This can't work with a ##fixnum-overflow since it branches
-    dup ##fixnum-overflow? [ bad-case-2 ] when
     dup dst>> reg-class>> next-vreg
-    [ swap src1>> emit-copy ]
-    [ [ >>src1 ] [ >>dst ] bi , ]
-    [ [ src2>> ] dip emit-copy ]
+    [ swap src2>> emit-copy ]
+    [ drop [ src2>> ] [ src1>> ] bi emit-copy ]
+    [ >>src2 dup dst>> >>src1 , ]
     2tri ; inline
 
 : case-3 ( insn -- )