]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/compiler/cfg/phi-elimination/phi-elimination.factor
compiler.cfg.phi-elimination: move some utilities from compiler.cfg.utilities here...
[factor.git] / basis / compiler / cfg / phi-elimination / phi-elimination.factor
index 7e73f0b8549408b5ace81c58a60c85f2f3b01e19..38e82176cae63106238c164c58d6a8e7cc94841c 100644 (file)
@@ -6,6 +6,20 @@ 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 ;