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