compiler.cfg: cleanup
parent
df86d1341f
commit
e90712b1ed
|
@ -319,5 +319,5 @@ M: insn eliminate-dead-stores* ;
|
||||||
compute-live-stores
|
compute-live-stores
|
||||||
eliminate-dead-stores ;
|
eliminate-dead-stores ;
|
||||||
|
|
||||||
: alias-analysis ( cfg -- cfg' )
|
: alias-analysis ( cfg -- cfg )
|
||||||
[ alias-analysis-step ] local-optimization ;
|
dup [ alias-analysis-step ] simple-optimization ;
|
||||||
|
|
|
@ -39,8 +39,8 @@ SYMBOL: visited
|
||||||
[ drop basic-block set ]
|
[ drop basic-block set ]
|
||||||
[ change-instructions drop ] 2bi ; inline
|
[ change-instructions drop ] 2bi ; inline
|
||||||
|
|
||||||
: local-optimization ( ... cfg quot: ( ... insns -- ... insns' ) -- ... cfg' )
|
: simple-optimization ( ... cfg quot: ( ... insns -- ... insns' ) -- ... )
|
||||||
dupd '[ _ optimize-basic-block ] each-basic-block ; inline
|
'[ _ optimize-basic-block ] each-basic-block ; inline
|
||||||
|
|
||||||
: needs-post-order ( cfg -- cfg' )
|
: needs-post-order ( cfg -- cfg' )
|
||||||
dup post-order drop ;
|
dup post-order drop ;
|
||||||
|
|
|
@ -123,11 +123,8 @@ M: ##phi useful-insn? drop f ;
|
||||||
|
|
||||||
M: insn useful-insn? drop t ;
|
M: insn useful-insn? drop t ;
|
||||||
|
|
||||||
: cleanup-block ( bb -- )
|
|
||||||
instructions>> [ useful-insn? ] filter! drop ;
|
|
||||||
|
|
||||||
: cleanup-cfg ( cfg -- )
|
: cleanup-cfg ( cfg -- )
|
||||||
[ cleanup-block ] each-basic-block ;
|
[ [ useful-insn? ] filter! ] simple-optimization ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ M: array process-instruction
|
||||||
init-value-graph
|
init-value-graph
|
||||||
[ process-instruction ] map flatten ;
|
[ process-instruction ] map flatten ;
|
||||||
|
|
||||||
: value-numbering ( cfg -- cfg' )
|
: value-numbering ( cfg -- cfg )
|
||||||
[ value-numbering-step ] local-optimization
|
dup [ value-numbering-step ] simple-optimization
|
||||||
|
|
||||||
cfg-changed predecessors-changed ;
|
cfg-changed predecessors-changed ;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
! Copyright (C) 2008, 2009 Slava Pestov, Daniel Ehrenberg.
|
! Copyright (C) 2008, 2010 Slava Pestov, Daniel Ehrenberg.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs combinators.short-circuit
|
USING: accessors assocs combinators.short-circuit
|
||||||
compiler.cfg.instructions compiler.cfg.rpo kernel namespaces
|
compiler.cfg.instructions compiler.cfg.rpo kernel namespaces
|
||||||
|
@ -35,10 +35,10 @@ M: ##copy eliminate-write-barrier
|
||||||
|
|
||||||
M: insn eliminate-write-barrier drop t ;
|
M: insn eliminate-write-barrier drop t ;
|
||||||
|
|
||||||
: write-barriers-step ( bb -- )
|
: write-barriers-step ( insns -- insns' )
|
||||||
H{ } clone fresh-allocations set
|
H{ } clone fresh-allocations set
|
||||||
H{ } clone mutated-objects set
|
H{ } clone mutated-objects set
|
||||||
instructions>> [ eliminate-write-barrier ] filter! drop ;
|
[ eliminate-write-barrier ] filter! ;
|
||||||
|
|
||||||
: eliminate-write-barriers ( cfg -- cfg' )
|
: eliminate-write-barriers ( cfg -- cfg )
|
||||||
dup [ write-barriers-step ] each-basic-block ;
|
dup [ write-barriers-step ] simple-optimization ;
|
||||||
|
|
Loading…
Reference in New Issue