]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/compiler/cfg/parallel-copy/parallel-copy.factor
use reject instead of [ ... not ] filter.
[factor.git] / basis / compiler / cfg / parallel-copy / parallel-copy.factor
index 1961d320495896094b0bff833452599f233ea8aa..1a7be5d8fd76f9bdc46f9172a447d4d448011721 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: assocs compiler.cfg.instructions compiler.cfg.registers
 compiler.cfg.ssa.destruction.leaders cpu.architecture deques
-dlists fry kernel locals namespaces sequences ;
+dlists fry kernel locals make namespaces sequences ;
 FROM: sets => conjoin ;
 IN: compiler.cfg.parallel-copy
 
@@ -14,7 +14,7 @@ SYMBOLS: locs preds to-do ready ;
     to-do get push-all-back ;
 
 : init-ready ( bs -- )
-    locs get '[ _ key? not ] filter ready get push-all-front ;
+    locs get '[ _ key? ] reject ready get push-all-front ;
 
 : init ( mapping -- )
     <dlist> to-do set
@@ -41,7 +41,6 @@ SYMBOLS: locs preds to-do ready ;
 PRIVATE>
 
 :: parallel-mapping ( mapping temp: ( src -- dst ) quot: ( dst src -- ) -- )
-    ! mapping is a list of { dst src } pairs
     [
         mapping init
         to-do get [
@@ -52,8 +51,8 @@ PRIVATE>
         ] slurp-deque
     ] with-scope ; inline
 
-: parallel-copy ( mapping -- )
-    next-vreg '[ drop _ ] [ any-rep ##copy, ] parallel-mapping ;
+: parallel-copy ( mapping -- insns )
+    [ next-vreg '[ drop _ ] [ any-rep ##copy, ] parallel-mapping ] { } make ;
 
 <PRIVATE
 
@@ -65,7 +64,8 @@ SYMBOL: temp-vregs
 
 PRIVATE>
 
-: parallel-copy-rep ( mapping -- )
-    ! mapping is a list of { dst src } pairs
-    H{ } clone temp-vregs set
-    [ rep-of temp-vreg ] [ dup rep-of ##copy, ] parallel-mapping ;
+: parallel-copy-rep ( mapping -- insns )
+    [
+        H{ } clone temp-vregs set
+        [ rep-of temp-vreg ] [ dup rep-of ##copy, ] parallel-mapping
+    ] { } make ;