1 19 20 25 26 27 package soot.toolkits.scalar; 28 29 import soot.*; 30 import soot.toolkits.graph.*; 31 import soot.util.*; 32 import java.util.*; 33 import soot.options.*; 34 import soot.toolkits.graph.interaction.*; 35 36 40 public abstract class AbstractFlowAnalysis 41 { 42 43 protected Map unitToBeforeFlow; 44 45 46 protected Map filterUnitToBeforeFlow; 47 48 49 protected DirectedGraph graph; 50 51 52 public AbstractFlowAnalysis(DirectedGraph graph) 53 { 54 unitToBeforeFlow = new HashMap(graph.size() * 2 + 1, 0.7f); 55 this.graph = graph; 56 if (Options.v().interactive_mode()){ 57 InteractionHandler.v().handleCfgEvent(graph); 58 } 59 } 60 61 65 protected abstract Object newInitialFlow(); 66 67 70 protected abstract Object entryInitialFlow(); 71 72 75 protected final void customizeInitialFlowGraph() {} 76 77 81 protected boolean treatTrapHandlersAsEntries() { return false; } 82 83 84 protected abstract boolean isForward(); 85 86 90 protected abstract void merge(Object in1, Object in2, Object out); 91 92 93 protected abstract void copy(Object source, Object dest); 94 95 97 protected abstract void doAnalysis(); 98 99 100 public Object getFlowBefore(Object s) 101 { 102 return unitToBeforeFlow.get(s); 103 } 104 105 protected void merge(Object inout, Object in) { 106 Object tmp = newInitialFlow(); 107 merge(inout, in, tmp); 108 copy(tmp, inout); 109 } 110 } 111 | Popular Tags |