compiler.cfg.phi-elimination: move some utilities from compiler.cfg.utilities here since that's the only place they get used

db4
Slava Pestov 2009-07-24 16:45:31 -05:00
parent 13c3fdcb5c
commit 4624af75f4
2 changed files with 14 additions and 14 deletions

View 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 ;

View File

@ -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 <simple-block> insert-basic-block ] assoc-each ;