/**
  * @see
  *     com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter#getIR(com.ibm.wala.ipa.callgraph.CGNode)
  */
 @Override
 public IR getIR(CGNode node) {
   if (node == null) {
     throw new IllegalArgumentException("node is null");
   }
   assert understands(node);
   if (DEBUG) {
     System.err.println("generating IR for " + node);
   }
   IMethod method = node.getMethod();
   GetMethodContext context = (GetMethodContext) node.getContext();
   Map<Integer, ConstantValue> constants = HashMapFactory.make();
   if (method.getReference().equals(GET_METHOD)) {
     Atom name = Atom.findOrCreateAsciiAtom(context.getName());
     SSAInstruction instrs[] = makeGetMethodStatements(context, constants, name);
     return new SyntheticIR(
         method,
         context,
         new InducedCFG(instrs, method, context),
         instrs,
         SSAOptions.defaultOptions(),
         constants);
   }
   if (method.getReference().equals(GET_DECLARED_METHOD)) {
     Atom name = Atom.findOrCreateAsciiAtom(context.getName());
     SSAInstruction instrs[] = makeGetDeclaredMethodStatements(context, constants, name);
     return new SyntheticIR(
         method,
         context,
         new InducedCFG(instrs, method, context),
         instrs,
         SSAOptions.defaultOptions(),
         constants);
   }
   Assertions.UNREACHABLE("Unexpected method " + node);
   return null;
 }
  public static ExceptionPruneAnalysis createBarcodeTest()
      throws WalaException, IOException, IllegalArgumentException, CallGraphBuilderCancelException {
    com.ibm.wala.ipa.callgraph.impl.Util.setNativeSpec("test_lib/natives_empty.xml");

    AnalysisScope scope = AnalysisScopeReader.makePrimordialScope(null);

    SetOfClasses exclusions = new FileOfClasses(new ByteArrayInputStream("com/sun/.*".getBytes()));
    scope.setExclusions(exclusions);

    ClassLoaderReference primordial = scope.getLoader(AnalysisScope.PRIMORDIAL);
    AnalysisScopeReader.addClassPathToScope("test_lib/jSDG-stubs-j2me2.0.jar", scope, primordial);
    AnalysisScopeReader.addClassPathToScope("test_lib/primordial.jar", scope, primordial);
    ClassLoaderReference loader = scope.getLoader(AnalysisScope.APPLICATION);
    AnalysisScopeReader.addClassPathToScope(classPath, scope, loader);

    // Klassenhierarchie berechnen
    System.out.println("Creating class hierarchy...");
    ClassHierarchy cha = ClassHierarchy.make(scope);
    System.out.println("Done.");

    AnalysisCache cache = new AnalysisCache();

    Iterable<Entrypoint> entries = Util.makeMainEntrypoints(scope, cha, "LMainEmulator");
    //        MethodReference mr = StringStuff.makeMethodReference(Language.JAVA, methodSig);
    //        IMethod m = cha.resolveMethod(mr);
    if (entries == null || !entries.iterator().hasNext()) {
      throw new IllegalStateException("Could not find main method in MainEmulator");
    }

    //        Set<Entrypoint> entries = HashSetFactory.make();
    //        entries.add(new DefaultEntrypoint(m, cha));
    AnalysisOptions options = new AnalysisOptions();
    options.getSSAOptions().setPiNodePolicy(SSAOptions.getAllBuiltInPiNodes());
    options.setEntrypoints(entries);
    CallGraphBuilder builder = Util.makeZeroCFABuilder(options, cache, cha, scope);

    System.out.println("Creating call graph...");
    CallGraph cg = builder.makeCallGraph(options, null);
    System.out.println("Done.");

    PointerAnalysis pta = builder.getPointerAnalysis();

    ExceptionPruneAnalysis mCFG = new ExceptionPruneAnalysis(cg, pta, cache);

    return mCFG;
  }
  public static ExceptionPruneAnalysis create(String methodSig)
      throws WalaException, IOException, IllegalArgumentException, CallGraphBuilderCancelException {
    AnalysisScope scope = AnalysisScopeReader.makePrimordialScope(null);

    SetOfClasses exclusions =
        new FileOfClasses(new ByteArrayInputStream(exclusionRegExp.getBytes()));
    scope.setExclusions(exclusions);

    ClassLoaderReference loader = scope.getLoader(AnalysisScope.APPLICATION);
    AnalysisScopeReader.addClassPathToScope(classPath, scope, loader);

    // Klassenhierarchie berechnen
    ClassHierarchy cha = ClassHierarchy.make(scope);

    AnalysisCache cache = new AnalysisCache();

    MethodReference mr = StringStuff.makeMethodReference(Language.JAVA, methodSig);
    IMethod m = cha.resolveMethod(mr);
    if (m == null) {
      throw new IllegalStateException("Could not resolve " + mr);
    }

    Set<Entrypoint> entries = HashSetFactory.make();
    entries.add(new DefaultEntrypoint(m, cha));
    AnalysisOptions options = new AnalysisOptions();
    options.getSSAOptions().setPiNodePolicy(SSAOptions.getAllBuiltInPiNodes());
    options.setEntrypoints(entries);
    CallGraphBuilder builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope);
    CallGraph cg = builder.makeCallGraph(options, null);

    PointerAnalysis pta = builder.getPointerAnalysis();

    ExceptionPruneAnalysis mCFG = new ExceptionPruneAnalysis(cg, pta, cache);

    return mCFG;
  }
 public SSAInstruction[] getStatements() {
   return getStatements(SSAOptions.defaultOptions());
 }