"/library/bootstrap/image.factor"
+ "/library/compiler/architecture.factor"
+
"/library/inference/shuffle.factor"
"/library/inference/dataflow.factor"
"/library/inference/inference.factor"
"/library/inference/stack.factor"
"/library/inference/call-optimizers.factor"
"/library/inference/print-dataflow.factor"
-
- "/library/compiler/architecture.factor"
+
"/library/compiler/assembler.factor"
"/library/compiler/relocate.factor"
"/library/compiler/xt.factor"
! Copyright (C) 2004, 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license.
IN: inference
-USING: generic hashtables inference kernel lists
-matrices namespaces sequences vectors ;
+USING: compiler-frontend generic hashtables inference kernel
+lists math matrices namespaces sequences vectors ;
! We use the recursive-state variable here, to track nested
! label scopes, to prevent infinite loops when inlining
[ node-out-d empty? ] prune-if ;
! #shuffle
+: compose-shuffle-nodes ( #shuffle #shuffle -- #shuffle/t )
+ [ >r node-shuffle r> node-shuffle compose-shuffle ] keep
+ over shuffle-in-d length pick shuffle-in-r length + vregs > [
+ 2drop t
+ ] [
+ [ set-node-shuffle ] keep
+ ] ifte ;
+
M: #shuffle optimize-node* ( node -- node/t )
dup node-successor dup #shuffle? [
- [ >r node-shuffle r> node-shuffle compose-shuffle ] keep
- [ set-node-shuffle ] keep
+ compose-shuffle-nodes
] [
drop [
dup node-in-d empty? swap node-in-r empty? and