compiler: rename cleanup to cleanup-tree, cleanup* to cleanup-tree*

db4
Doug Coleman 2015-06-05 21:08:18 -07:00
parent 20a1c09a42
commit 808342076d
3 changed files with 16 additions and 16 deletions

View File

@ -21,12 +21,12 @@ M: node delete-node drop ;
: delete-nodes ( nodes -- ) [ delete-node ] each-node ;
GENERIC: cleanup* ( node -- node/nodes )
GENERIC: cleanup-tree* ( node -- node/nodes )
: cleanup ( nodes -- nodes' )
: cleanup-tree ( nodes -- nodes' )
#! We don't recurse into children here, instead the methods
#! do it since the logic is a bit more involved
[ cleanup* ] map-flat ;
[ cleanup-tree* ] map-flat ;
! Constant folding
: cleanup-folding? ( #call -- ? )
@ -77,7 +77,7 @@ GENERIC: cleanup* ( node -- node/nodes )
[ word>> add-depends-on-definition ] if ;
: cleanup-inlining ( #call -- nodes )
[ record-inlining ] [ body>> cleanup ] bi ;
[ record-inlining ] [ body>> cleanup-tree ] bi ;
! Removing overflow checks
: (remove-overflow-check?) ( #call -- ? )
@ -95,9 +95,9 @@ GENERIC: cleanup* ( node -- node/nodes )
} cond ;
: remove-overflow-check ( #call -- #call )
[ no-overflow-variant ] change-word cleanup* ;
[ no-overflow-variant ] change-word cleanup-tree* ;
M: #call cleanup*
M: #call cleanup-tree*
{
{ [ dup body>> ] [ cleanup-inlining ] }
{ [ dup cleanup-folding? ] [ cleanup-folding ] }
@ -125,9 +125,9 @@ M: #call cleanup*
SYMBOL: live-branches
: cleanup-children ( #branch -- )
[ [ cleanup ] map ] change-children drop ;
[ [ cleanup-tree ] map ] change-children drop ;
M: #branch cleanup*
M: #branch cleanup-tree*
{
[ delete-unreachable-branches ]
[ cleanup-children ]
@ -151,7 +151,7 @@ M: #branch cleanup*
[ drop ]
} case ;
M: #phi cleanup*
M: #phi cleanup-tree*
#! Remove #phi function inputs which no longer exist.
live-branches get
[ '[ _ sift-children ] change-phi-in-d ]
@ -169,12 +169,12 @@ M: #phi cleanup*
unclip >copy prefix
unclip-last >copy suffix ;
M: #recursive cleanup*
M: #recursive cleanup-tree*
#! Inline bodies of #recursive blocks with no calls left.
[ cleanup ] change-child
[ cleanup-tree ] change-child
dup label>> calls>> empty? [ flatten-recursive ] when ;
M: #alien-callback cleanup*
[ cleanup ] change-child ;
M: #alien-callback cleanup-tree*
[ cleanup-tree ] change-child ;
M: node cleanup* ;
M: node cleanup-tree* ;

View File

@ -12,7 +12,7 @@ IN: compiler.tree.late-optimizations
analyze-recursive
normalize
propagate
cleanup
cleanup-tree
compute-def-use
remove-dead-code
but-last

View File

@ -28,7 +28,7 @@ SYMBOL: check-optimizer?
analyze-recursive
normalize
propagate
cleanup
cleanup-tree
dup run-escape-analysis? [
escape-analysis
unbox-tuples