1 19 20 package edu.umd.cs.findbugs.ba; 21 22 import java.util.BitSet ; 23 24 import org.apache.bcel.classfile.Method; 25 26 import edu.umd.cs.findbugs.SystemProperties; 27 28 35 public class PostDominatorsAnalysis extends AbstractDominatorsAnalysis { 36 final private ReverseDepthFirstSearch rdfs; 37 final private DepthFirstSearch dfs; 38 39 47 public PostDominatorsAnalysis(CFG cfg, ReverseDepthFirstSearch rdfs, DepthFirstSearch dfs, EdgeChooser edgeChooser) { 48 super(cfg, edgeChooser); 49 this.rdfs = rdfs; 50 this.dfs = dfs; 51 } 52 53 61 public PostDominatorsAnalysis(CFG cfg, ReverseDepthFirstSearch rdfs, 62 DepthFirstSearch dfs, boolean ignoreExceptionEdges) { 63 super(cfg, ignoreExceptionEdges); 64 this.rdfs = rdfs; 65 this.dfs = dfs; 66 } 67 68 public boolean isForwards() { 69 return false; 70 } 71 72 public BlockOrder getBlockOrder(CFG cfg) { 73 return new ReverseDFSOrder(cfg, rdfs, dfs); 74 } 75 76 public static void main(String [] args) throws Exception { 77 if (args.length != 1) { 78 System.err.println("Usage: " + PostDominatorsAnalysis.class.getName() + " <classfile>"); 79 System.exit(1); 80 } 81 82 DataflowTestDriver<BitSet , PostDominatorsAnalysis> driver = 83 new DataflowTestDriver<BitSet , PostDominatorsAnalysis>() { 84 85 88 @Override 89 public Dataflow<BitSet , PostDominatorsAnalysis> createDataflow(ClassContext classContext, Method method) throws CFGBuilderException, DataflowAnalysisException { 90 CFG cfg = classContext.getCFG(method); 91 ReverseDepthFirstSearch rdfs = classContext.getReverseDepthFirstSearch(method); 92 93 PostDominatorsAnalysis analysis = 94 new PostDominatorsAnalysis(cfg, rdfs, classContext.getDepthFirstSearch(method), SystemProperties.getBoolean("dominators.ignoreexceptionedges")); 95 96 Dataflow<BitSet , PostDominatorsAnalysis> dataflow = 97 new Dataflow<BitSet , PostDominatorsAnalysis>(cfg, analysis); 98 99 dataflow.execute(); 100 101 return dataflow; 102 } 103 104 }; 105 106 driver.execute(args[0]); 107 } 108 } 109 110 | Popular Tags |