public RelevantVariableFinder(SSAInstruction instrcution) { this.varNumNew = -1; instrcution.visit(this); this.varNum = this.varNumNew; }
@Override public AbstractOperator<TypeVariable> get(SSAInstruction instruction) { instruction.visit(this); AbstractOperator<TypeVariable> temp = result; result = null; return temp; }
@Override public AbstractOperator<TypeVariable> get(SSAInstruction instruction) { instruction.visit(this); AbstractOperator<TypeVariable> temp = result; result = null; return temp; }
public RelevantVariableFinder(SSAInstruction instrcution) { this.varNumNew = -1; instrcution.visit(this); this.varNum = this.varNumNew; }
/** * @param statements list of ssa statements * @return List of InvokeInstruction */ private static List<NewSiteReference> getNewSites(SSAInstruction[] statements) { final List<NewSiteReference> result = new LinkedList<>(); Visitor v = new Visitor() { @Override public void visitNew(SSANewInstruction instruction) { result.add(instruction.getNewSite()); } }; for (SSAInstruction s : statements) { if (s != null) { s.visit(v); } } return result; }
/** * visit each instruction in this IR */ public void visitAllInstructions(SSAInstruction.IVisitor v) { for (SSAInstruction inst : Iterator2Iterable.make(iterateAllInstructions())) { inst.visit(v); } }
/** * visit each normal (non-phi, non-pi, non-catch) instruction in this IR */ public void visitNormalInstructions(SSAInstruction.IVisitor v) { for (SSAInstruction inst : Iterator2Iterable.make(iterateNormalInstructions())) { inst.visit(v); } }
/** * visit each normal (non-phi, non-pi, non-catch) instruction in this IR */ public void visitNormalInstructions(SSAInstruction.IVisitor v) { for (SSAInstruction inst : Iterator2Iterable.make(iterateNormalInstructions())) { inst.visit(v); } }
/** * visit each instruction in this IR */ public void visitAllInstructions(SSAInstruction.IVisitor v) { for (SSAInstruction inst : Iterator2Iterable.make(iterateAllInstructions())) { inst.visit(v); } }
/** * Add constraints for a particular basic block. */ protected void addBlockInstructionConstraints(CGNode node, ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg, ISSABasicBlock b, StatementVisitor v) { v.setBasicBlock(b); // visit each instruction in the basic block. for (SSAInstruction s : b) { if (s != null) { s.visit(v); } } addPhiConstraints(node, cfg, b); }
/** * Add constraints for a particular basic block. */ protected void addBlockInstructionConstraints(CGNode node, ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg, ISSABasicBlock b, StatementVisitor v) { v.setBasicBlock(b); // visit each instruction in the basic block. for (SSAInstruction s : b) { if (s != null) { s.visit(v); } } addPhiConstraints(node, cfg, b); }
/** * Add constraints for a particular basic block. */ protected void addBlockInstructionConstraints(CGNode node, ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg, ISSABasicBlock b, FlowStatementVisitor v) { v.setBasicBlock(b); // visit each instruction in the basic block. for (SSAInstruction s : b) { if (s != null) { s.visit(v); } } addPhiConstraints(node, cfg, b); }
/** * Add constraints for a particular basic block. */ protected void addBlockInstructionConstraints(CGNode node, ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg, ISSABasicBlock b, FlowStatementVisitor v) { v.setBasicBlock(b); // visit each instruction in the basic block. for (SSAInstruction s : b) { if (s != null) { s.visit(v); } } addPhiConstraints(node, cfg, b); }
/** * Compute the set of {@link PointerKey}s that represent pointers that instruction s may read. */ public Set<PointerKey> getRef(CGNode n, ExtendedHeapModel h, PointerAnalysis<T> pa, SSAInstruction s, HeapExclusions hexcl) { if (s == null) { throw new IllegalArgumentException("s is null"); } Set<PointerKey> result = HashSetFactory.make(2); RefVisitor v = makeRefVisitor(n, result, pa, h); s.visit(v); return hexcl == null ? result : hexcl.filter(result); }
/** * Compute the set of {@link PointerKey}s that represent pointers that instruction s may read. */ public Set<PointerKey> getRef(CGNode n, ExtendedHeapModel h, PointerAnalysis<T> pa, SSAInstruction s, HeapExclusions hexcl) { if (s == null) { throw new IllegalArgumentException("s is null"); } Set<PointerKey> result = HashSetFactory.make(2); RefVisitor v = makeRefVisitor(n, result, pa, h); s.visit(v); return hexcl == null ? result : hexcl.filter(result); }
/** * Compute the set of {@link PointerKey}s that represent pointers that instruction s may write to. */ public Set<PointerKey> getMod(CGNode n, ExtendedHeapModel h, PointerAnalysis<T> pa, SSAInstruction s, HeapExclusions hexcl, boolean ignoreAllocHeapDefs) { if (s == null) { throw new IllegalArgumentException("s is null"); } Set<PointerKey> result = HashSetFactory.make(2); ModVisitor v = makeModVisitor(n, result, pa, h, ignoreAllocHeapDefs); s.visit(v); return hexcl == null ? result : hexcl.filter(result); }
/** * Compute the set of {@link PointerKey}s that represent pointers that instruction s may write to. */ public Set<PointerKey> getMod(CGNode n, ExtendedHeapModel h, PointerAnalysis<T> pa, SSAInstruction s, HeapExclusions hexcl, boolean ignoreAllocHeapDefs) { if (s == null) { throw new IllegalArgumentException("s is null"); } Set<PointerKey> result = HashSetFactory.make(2); ModVisitor v = makeModVisitor(n, result, pa, h, ignoreAllocHeapDefs); s.visit(v); return hexcl == null ? result : hexcl.filter(result); }
public boolean hasNoInterestingUses(CGNode node, int vn, DefUse du) { if (du == null) { throw new IllegalArgumentException("du is null"); } if (vn <= 0) { throw new IllegalArgumentException("v is invalid: " + vn); } // todo: enhance this by solving a dead-code elimination // problem. InterestingVisitor v = makeInterestingVisitor(node, vn); for (SSAInstruction s : Iterator2Iterable.make(du.getUses(v.vn))) { s.visit(v); if (v.bingo) { return false; } } return true; }
public boolean hasNoInterestingUses(CGNode node, int vn, DefUse du) { if (du == null) { throw new IllegalArgumentException("du is null"); } if (vn <= 0) { throw new IllegalArgumentException("v is invalid: " + vn); } // todo: enhance this by solving a dead-code elimination // problem. InterestingVisitor v = makeInterestingVisitor(node, vn); for (SSAInstruction s : Iterator2Iterable.make(du.getUses(v.vn))) { s.visit(v); if (v.bingo) { return false; } } return true; }
private List<Element> summarizeInstructions(MethodSummary summary) { SSAtoXMLVisitor v = new SSAtoXMLVisitor(doc, summary.getNumberOfParameters()); for (SSAInstruction inst : summary.getStatements()) { inst.visit(v); } return v.getInstSummary(); }