add some comments
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2007 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
2a1213789b
commit
da522dcff3
|
@ -16,6 +16,7 @@ import com.ibm.wala.shrikeBT.ConditionalBranchInstruction;
|
||||||
import com.ibm.wala.ssa.SSAConditionalBranchInstruction;
|
import com.ibm.wala.ssa.SSAConditionalBranchInstruction;
|
||||||
import com.ibm.wala.ssa.SSAInstruction;
|
import com.ibm.wala.ssa.SSAInstruction;
|
||||||
import com.ibm.wala.ssa.SSASwitchInstruction;
|
import com.ibm.wala.ssa.SSASwitchInstruction;
|
||||||
|
import com.ibm.wala.ssa.SymbolTable;
|
||||||
import com.ibm.wala.util.debug.Assertions;
|
import com.ibm.wala.util.debug.Assertions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -133,6 +134,14 @@ public class Util {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To which {@link IBasicBlock} does control flow from basic block bb, which ends in a
|
||||||
|
* conditional branch, when the conditional branch operands evaluate to the
|
||||||
|
* constants c1 and c2, respectively.
|
||||||
|
*
|
||||||
|
* Callers must resolve the constant values from the {@link SymbolTable}
|
||||||
|
* before calling this method. These integers are <bf>not</bf> value numbers;
|
||||||
|
*/
|
||||||
public static <T extends IBasicBlock> T resolveBranch(ControlFlowGraph<T> G, T bb, int c1, int c2) {
|
public static <T extends IBasicBlock> T resolveBranch(ControlFlowGraph<T> G, T bb, int c1, int c2) {
|
||||||
SSAConditionalBranchInstruction c = (SSAConditionalBranchInstruction) getLastInstruction(G, bb);
|
SSAConditionalBranchInstruction c = (SSAConditionalBranchInstruction) getLastInstruction(G, bb);
|
||||||
switch ((ConditionalBranchInstruction.Operator) c.getOperator()) {
|
switch ((ConditionalBranchInstruction.Operator) c.getOperator()) {
|
||||||
|
|
|
@ -33,6 +33,12 @@ import com.ibm.wala.util.intset.IntSet;
|
||||||
import com.ibm.wala.util.intset.IntSetUtil;
|
import com.ibm.wala.util.intset.IntSetUtil;
|
||||||
import com.ibm.wala.util.intset.MutableIntSet;
|
import com.ibm.wala.util.intset.MutableIntSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a view of a portion of a call graph.
|
||||||
|
*
|
||||||
|
* @author Julian Dolby
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class PartialCallGraph extends DelegatingGraph<CGNode> implements CallGraph {
|
public class PartialCallGraph extends DelegatingGraph<CGNode> implements CallGraph {
|
||||||
|
|
||||||
private final CallGraph cg;
|
private final CallGraph cg;
|
||||||
|
@ -55,6 +61,11 @@ public class PartialCallGraph extends DelegatingGraph<CGNode> implements CallGra
|
||||||
return new PartialCallGraph(CG, partialRoots, partialGraph);
|
return new PartialCallGraph(CG, partialRoots, partialGraph);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CG the original call graph
|
||||||
|
* @param partialRoots roots of the new, partial graph
|
||||||
|
* the result contains only nodes reachable from the partialRoots in the original call graph.
|
||||||
|
*/
|
||||||
public static PartialCallGraph make(CallGraph CG, Collection<CGNode> partialRoots) {
|
public static PartialCallGraph make(CallGraph CG, Collection<CGNode> partialRoots) {
|
||||||
final Set<CGNode> nodes = DFS.getReachableNodes(CG, partialRoots);
|
final Set<CGNode> nodes = DFS.getReachableNodes(CG, partialRoots);
|
||||||
Graph<CGNode> partialGraph = GraphSlicer.prune(CG, new Filter<CGNode>() {
|
Graph<CGNode> partialGraph = GraphSlicer.prune(CG, new Filter<CGNode>() {
|
||||||
|
|
Loading…
Reference in New Issue