From 4624af75f4047644423049ec60e5d02f0d438114 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 24 Jul 2009 16:45:31 -0500 Subject: [PATCH] compiler.cfg.phi-elimination: move some utilities from compiler.cfg.utilities here since that's the only place they get used --- .../cfg/phi-elimination/phi-elimination.factor | 14 ++++++++++++++ basis/compiler/cfg/utilities/utilities.factor | 14 -------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/basis/compiler/cfg/phi-elimination/phi-elimination.factor b/basis/compiler/cfg/phi-elimination/phi-elimination.factor index 7e73f0b854..38e82176ca 100644 --- a/basis/compiler/cfg/phi-elimination/phi-elimination.factor +++ b/basis/compiler/cfg/phi-elimination/phi-elimination.factor @@ -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 insert-basic-block ] assoc-each ; + : insert-copy ( predecessor input output -- ) '[ _ _ swap ##copy ] add-instructions ; diff --git a/basis/compiler/cfg/utilities/utilities.factor b/basis/compiler/cfg/utilities/utilities.factor index ad3ee9c57b..4b0468b911 100644 --- a/basis/compiler/cfg/utilities/utilities.factor +++ b/basis/compiler/cfg/utilities/utilities.factor @@ -48,16 +48,6 @@ SYMBOL: visited : skip-empty-blocks ( bb -- bb' ) H{ } clone visited [ (skip-empty-blocks) ] with-variable ; -! 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-block ( from to bb -- ) bb from 1vector >>predecessors drop bb to 1vector >>successors drop @@ -69,7 +59,3 @@ SYMBOL: added-instructions swap >vector \ ##branch new-insn over push >>instructions ; - -: insert-basic-blocks ( bb -- ) - [ added-instructions get ] dip - '[ [ _ ] dip insert-basic-block ] assoc-each ;