]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/compiler/cfg/phi-elimination/phi-elimination.factor
compiler.cfg.phi-elimination: no longer needed
[factor.git] / basis / compiler / cfg / phi-elimination / phi-elimination.factor
diff --git a/basis/compiler/cfg/phi-elimination/phi-elimination.factor b/basis/compiler/cfg/phi-elimination/phi-elimination.factor
deleted file mode 100644 (file)
index 38e8217..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-! Copyright (C) 2009 Slava Pestov, Daniel Ehrenberg.
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs fry kernel sequences namespaces
-compiler.cfg compiler.cfg.instructions compiler.cfg.rpo
-compiler.cfg.utilities compiler.cfg.hats make
-locals ;
-IN: compiler.cfg.phi-elimination
-
-! assoc mapping predecessors to sequences
-SYMBOL: added-instructions
-
-: add-instructions ( predecessor quot -- )
-    [
-        added-instructions get
-        [ drop V{ } clone ] cache
-        building
-    ] dip with-variable ; inline
-
-: insert-basic-blocks ( bb -- )
-    [ added-instructions get ] dip
-    '[ [ _ ] dip <simple-block> insert-basic-block ] assoc-each ;
-
-: insert-copy ( predecessor input output -- )
-    '[ _ _ swap ##copy ] add-instructions ;
-
-: eliminate-phi ( ##phi -- ##copy )
-    i
-    [ [ inputs>> ] dip '[ _ insert-copy ] assoc-each ]
-    [ [ dst>> ] dip \ ##copy new-insn ]
-    2bi ;
-
-: eliminate-phi-step ( bb -- )
-    H{ } clone added-instructions set
-    [ instructions>> [ dup ##phi? [ eliminate-phi ] when ] change-each ]
-    [ insert-basic-blocks ]
-    bi ;
-
-: eliminate-phis ( cfg -- cfg' )
-    dup [ eliminate-phi-step ] each-basic-block
-    cfg-changed ;