compiler.cfg.phi-elimination: move some utilities from compiler.cfg.utilities here since that's the only place they get used
parent
13c3fdcb5c
commit
4624af75f4
|
@ -6,6 +6,20 @@ compiler.cfg.utilities compiler.cfg.hats make
|
||||||
locals ;
|
locals ;
|
||||||
IN: compiler.cfg.phi-elimination
|
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 -- )
|
: insert-copy ( predecessor input output -- )
|
||||||
'[ _ _ swap ##copy ] add-instructions ;
|
'[ _ _ swap ##copy ] add-instructions ;
|
||||||
|
|
||||||
|
|
|
@ -48,16 +48,6 @@ SYMBOL: visited
|
||||||
: skip-empty-blocks ( bb -- bb' )
|
: skip-empty-blocks ( bb -- bb' )
|
||||||
H{ } clone visited [ (skip-empty-blocks) ] with-variable ;
|
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 -- )
|
:: insert-basic-block ( from to bb -- )
|
||||||
bb from 1vector >>predecessors drop
|
bb from 1vector >>predecessors drop
|
||||||
bb to 1vector >>successors drop
|
bb to 1vector >>successors drop
|
||||||
|
@ -69,7 +59,3 @@ SYMBOL: added-instructions
|
||||||
swap >vector
|
swap >vector
|
||||||
\ ##branch new-insn over push
|
\ ##branch new-insn over push
|
||||||
>>instructions ;
|
>>instructions ;
|
||||||
|
|
||||||
: insert-basic-blocks ( bb -- )
|
|
||||||
[ added-instructions get ] dip
|
|
||||||
'[ [ _ ] dip <simple-block> insert-basic-block ] assoc-each ;
|
|
||||||
|
|
Loading…
Reference in New Issue