compiler.cfg: cleanup

db4
Slava Pestov 2010-04-30 18:55:20 -04:00
parent df86d1341f
commit e90712b1ed
5 changed files with 12 additions and 15 deletions

View File

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

View File

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

View File

@ -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>

View File

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

View File

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