| 1 19 20 25 26 27 package soot.jimple.toolkits.scalar.pre; 28 import soot.*; 29 import soot.toolkits.scalar.*; 30 import soot.toolkits.graph.*; 31 import soot.jimple.toolkits.scalar.*; 32 import soot.jimple.*; 33 import java.util.*; 34 import soot.util.*; 35 36 48 public class NotIsolatedAnalysis extends BackwardFlowAnalysis { 49 private LatestComputation unitToLatest; 50 private Map unitToGen; 51 private FlowSet set; 52 53 56 public NotIsolatedAnalysis(DirectedGraph dg) { 57 58 super(dg); 59 throw new RuntimeException ("Don't use this Constructor!"); 60 } 61 62 72 public NotIsolatedAnalysis(DirectedGraph dg, LatestComputation latest, 73 Map equivRhsMap) { 74 this(dg, latest, equivRhsMap, new 75 ArrayPackedSet(new CollectionFlowUniverse(equivRhsMap.values()))); 76 } 77 78 91 public NotIsolatedAnalysis(DirectedGraph dg, LatestComputation latest, 92 Map equivRhsMap, BoundedFlowSet set) { 93 super(dg); 94 UnitGraph g = (UnitGraph)dg; 95 this.set = set; 96 unitToGen = equivRhsMap; 97 unitToLatest = latest; 98 doAnalysis(); 99 } 100 101 protected Object newInitialFlow() { 102 return set.emptySet(); 103 } 104 105 protected Object entryInitialFlow() { 106 return newInitialFlow(); 107 } 108 109 protected void flowThrough(Object inValue, Object unit, Object outValue) { 110 111 FlowSet in = (FlowSet) inValue, out = (FlowSet) outValue; 112 113 in.copy(out); 114 115 EquivalentValue rhs = (EquivalentValue)unitToGen.get(unit); 117 if (rhs != null) 118 out.add(rhs); 119 120 FlowSet latest = (FlowSet)unitToLatest.getFlowBefore(unit); 122 out.difference(latest); 123 } 124 125 protected void merge(Object in1, Object in2, Object out) { 126 FlowSet inSet1 = (FlowSet) in1; 127 FlowSet inSet2 = (FlowSet) in2; 128 129 FlowSet outSet = (FlowSet) out; 130 131 inSet1.union(inSet2, outSet); 132 } 133 134 protected void copy(Object source, Object dest) { 135 FlowSet sourceSet = (FlowSet) source; 136 FlowSet destSet = (FlowSet) dest; 137 138 sourceSet.copy(destSet); 139 } 140 } 141 | Popular Tags |