factor/core/optimizer/optimizer.factor

22 lines
644 B
Factor
Raw Normal View History

2007-09-20 18:09:08 -04:00
! Copyright (C) 2006, 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
2008-02-05 21:11:35 -05:00
USING: kernel namespaces optimizer.backend optimizer.def-use
optimizer.known-words optimizer.math inference.class ;
2007-09-20 18:09:08 -04:00
IN: optimizer
: optimize-1 ( node -- newnode ? )
[
H{ } clone class-substitutions set
H{ } clone literal-substitutions set
H{ } clone value-substitutions set
dup compute-def-use
kill-values
2007-09-20 18:09:08 -04:00
dup infer-classes
optimizer-changed off
optimize-nodes
optimizer-changed get
] with-scope ;
: optimize ( node -- newnode )
optimize-1 [ optimize ] when ;