! Copyright (C) 2009 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs combinators.short-circuit compiler.cfg.predecessors
-compiler.cfg.rpo compiler.cfg.utilities deques dlists functors kernel lexer
-locals namespaces sequences ;
+! See https://factorcode.org/license.txt for BSD license.
+USING: accessors assocs combinators.short-circuit
+compiler.cfg.predecessors compiler.cfg.rpo
+compiler.cfg.utilities deques dlists functors kernel lexer
+namespaces sequences ;
IN: compiler.cfg.dataflow-analysis
GENERIC: join-sets ( sets bb dfa -- set )
in-sets
out-sets ; inline
-M: dataflow-analysis join-sets 2drop assoc-refine ;
+M: dataflow-analysis join-sets 2drop assoc-intersect-all ;
M: dataflow-analysis ignore-block? drop kill-block?>> ;
-FUNCTOR: define-analysis ( name -- )
+<FUNCTOR: define-analysis ( name -- )
name DEFINES-CLASS ${name}
name-ins DEFINES ${name}-ins
: name-out ( bb -- set ) name-outs get at ;
-;FUNCTOR
+;FUNCTOR>
! ! ! Forward dataflow analysis
M: forward-analysis successors drop successors>> ;
M: forward-analysis predecessors drop predecessors>> ;
-FUNCTOR: define-forward-analysis ( name -- )
+<FUNCTOR: define-forward-analysis ( name -- )
name IS ${name}
name-ins IS ${name}-ins
name run-dataflow-analysis
[ name-ins set ] [ name-outs set ] bi* ;
-;FUNCTOR
+;FUNCTOR>
! ! ! Backward dataflow analysis
M: backward-analysis successors drop predecessors>> ;
M: backward-analysis predecessors drop successors>> ;
-FUNCTOR: define-backward-analysis ( name -- )
+<FUNCTOR: define-backward-analysis ( name -- )
name IS ${name}
name-ins IS ${name}-ins
\ name run-dataflow-analysis
[ name-outs set ] [ name-ins set ] bi* ;
-;FUNCTOR
+;FUNCTOR>
PRIVATE>