]> gitweb.factorcode.org Git - factor.git/blob - extra/compiler/cfg/gvn/avail/avail.factor
compiler.cfg.gvn.avail: minor simplification
[factor.git] / extra / compiler / cfg / gvn / avail / avail.factor
1 ! Copyright (C) 2011 Alex Vondrak.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors assocs compiler.cfg
4 compiler.cfg.dataflow-analysis
5 compiler.cfg.def-use
6 compiler.cfg.predecessors compiler.cfg.rpo deques dlists
7 hashtables kernel locals namespaces sequences sets ;
8 FROM: namespaces => set ;
9 IN: compiler.cfg.gvn.avail
10
11 : defined ( bb -- vregs )
12     instructions>> [ defs-vregs ] map concat unique ;
13
14 ! This doesn't propagate across "kill blocks".  Not sure if
15 ! that's right, though I may as well assume as much.
16
17 FORWARD-ANALYSIS: avail
18
19 M: avail-analysis transfer-set drop defined assoc-union ;
20
21 : available? ( vn -- ? )
22     basic-block get avail-ins get at key? ;
23
24 : make-available ( insn -- insn )
25     dup dst>>
26     basic-block get avail-ins get [ dupd ?set-at ] change-at ;