1
2
3
4 package joeq.Compiler.Dataflow;
5
6 import jwutil.math.BitString;
7 import jwutil.strings.Strings;
8
9 public class GenKillTransferFunction implements TransferFunction {
10
11 protected final BitString gen, kill;
12
13 GenKillTransferFunction(int size) {
14 this.gen = new BitString(size);
15 this.kill = new BitString(size);
16 }
17 GenKillTransferFunction(BitString g, BitString k) {
18 this.gen = g; this.kill = k;
19 }
20
21 public String toString() {
22 return " Gen: "+gen+Strings.lineSep+" Kill: "+kill;
23 }
24
25
26
27
28 public Fact apply(Fact f) {
29 BitVectorFact r = (BitVectorFact) f;
30 BitString s = new BitString(r.fact.size());
31 s.or(r.fact);
32 s.minus(kill);
33 s.or(gen);
34 return r.makeNew(s);
35 }
36
37 }