2009-07-18 23:27:42 -04:00
|
|
|
! Copyright (C) 2009 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2016-03-16 09:37:33 -04:00
|
|
|
USING: assocs compiler.cfg.dataflow-analysis compiler.cfg.stacks.local
|
|
|
|
kernel namespaces sequences sets ;
|
2009-07-23 21:54:38 -04:00
|
|
|
IN: compiler.cfg.stacks.global
|
2009-07-18 23:27:42 -04:00
|
|
|
|
2015-03-31 19:34:56 -04:00
|
|
|
: peek-set ( bb -- assoc ) peek-sets get at ;
|
|
|
|
: replace-set ( bb -- assoc ) replace-sets get at ;
|
|
|
|
: kill-set ( bb -- assoc ) kill-sets get at ;
|
|
|
|
|
2015-04-01 22:56:40 -04:00
|
|
|
! Should exists somewhere else
|
|
|
|
: refine ( sets -- set )
|
|
|
|
[ f ] [ [ ] [ intersect ] map-reduce ] if-empty ;
|
|
|
|
|
|
|
|
: transfer-peeked-locs ( set bb -- set' )
|
|
|
|
[ replace-set diff ] [ peek-set union ] bi ;
|
2009-07-18 23:27:42 -04:00
|
|
|
|
2009-08-03 08:08:28 -04:00
|
|
|
BACKWARD-ANALYSIS: anticip
|
2009-07-18 23:27:42 -04:00
|
|
|
|
2016-03-16 09:37:33 -04:00
|
|
|
M: anticip transfer-set drop transfer-peeked-locs ;
|
|
|
|
M: anticip join-sets 2drop refine ;
|
2009-07-18 23:27:42 -04:00
|
|
|
|
2009-08-03 08:08:28 -04:00
|
|
|
BACKWARD-ANALYSIS: live
|
2009-07-18 23:27:42 -04:00
|
|
|
|
2016-03-16 09:37:33 -04:00
|
|
|
M: live transfer-set drop transfer-peeked-locs ;
|
|
|
|
M: live join-sets 2drop combine ;
|
2009-08-03 08:08:28 -04:00
|
|
|
|
2009-07-22 03:05:40 -04:00
|
|
|
FORWARD-ANALYSIS: avail
|
2009-07-18 23:27:42 -04:00
|
|
|
|
2016-03-16 09:37:33 -04:00
|
|
|
M: avail transfer-set
|
2015-04-01 22:56:40 -04:00
|
|
|
drop [ peek-set ] [ replace-set ] bi union union ;
|
2016-03-16 09:37:33 -04:00
|
|
|
M: avail join-sets 2drop refine ;
|
2009-08-03 08:08:28 -04:00
|
|
|
|
|
|
|
FORWARD-ANALYSIS: pending
|
|
|
|
|
2016-03-16 09:37:33 -04:00
|
|
|
M: pending transfer-set
|
2015-04-01 22:56:40 -04:00
|
|
|
drop replace-set union ;
|
2016-03-16 09:37:33 -04:00
|
|
|
M: pending join-sets 2drop refine ;
|
2009-07-18 23:27:42 -04:00
|
|
|
|
2009-08-03 08:08:28 -04:00
|
|
|
BACKWARD-ANALYSIS: dead
|
2009-07-18 23:27:42 -04:00
|
|
|
|
2016-03-16 09:37:33 -04:00
|
|
|
M: dead transfer-set
|
2015-04-01 22:56:40 -04:00
|
|
|
drop [ kill-set ] [ replace-set ] bi union union ;
|
2016-03-16 09:37:33 -04:00
|
|
|
M: dead join-sets 2drop refine ;
|