comments
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3514 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
9c26c6ee29
commit
abcdc0c608
|
@ -13,10 +13,14 @@ package com.ibm.wala.ssa;
|
|||
import com.ibm.wala.util.collections.Pair;
|
||||
|
||||
/**
|
||||
* combination of 2 pi node policies
|
||||
* A Combination of 2 {@link SSAPiNodePolicy}s. This policy will insert Pi nodes if either of two delegate policies says to.
|
||||
*/
|
||||
public class CompoundPiPolicy implements SSAPiNodePolicy {
|
||||
|
||||
/**
|
||||
* @param p1 first {@link SSAPiNodePolicy} to delegate to
|
||||
* @param p2 second {@link SSAPiNodePolicy} to delegate to
|
||||
*/
|
||||
public static CompoundPiPolicy createCompoundPiPolicy(SSAPiNodePolicy p1, SSAPiNodePolicy p2) {
|
||||
return new CompoundPiPolicy(p1, p2);
|
||||
}
|
||||
|
@ -24,6 +28,10 @@ public class CompoundPiPolicy implements SSAPiNodePolicy {
|
|||
private final SSAPiNodePolicy p1;
|
||||
private final SSAPiNodePolicy p2;
|
||||
|
||||
/**
|
||||
* @param p1 first {@link SSAPiNodePolicy} to delegate to
|
||||
* @param p2 second {@link SSAPiNodePolicy} to delegate to
|
||||
*/
|
||||
private CompoundPiPolicy(SSAPiNodePolicy p1, SSAPiNodePolicy p2) {
|
||||
this.p1 = p1;
|
||||
this.p2 = p2;
|
||||
|
@ -35,6 +43,9 @@ public class CompoundPiPolicy implements SSAPiNodePolicy {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @see com.ibm.wala.ssa.SSAPiNodePolicy#getPi(com.ibm.wala.ssa.SSAConditionalBranchInstruction, com.ibm.wala.ssa.SSAInstruction, com.ibm.wala.ssa.SSAInstruction, com.ibm.wala.ssa.SymbolTable)
|
||||
*/
|
||||
public Pair<Integer, SSAInstruction> getPi(SSAConditionalBranchInstruction cond, SSAInstruction def1, SSAInstruction def2,
|
||||
SymbolTable symbolTable) {
|
||||
Pair<Integer, SSAInstruction> result = p1.getPi(cond, def1, def2, symbolTable);
|
||||
|
@ -45,6 +56,9 @@ public class CompoundPiPolicy implements SSAPiNodePolicy {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see com.ibm.wala.ssa.SSAPiNodePolicy#getPi(com.ibm.wala.ssa.SSAAbstractInvokeInstruction, com.ibm.wala.ssa.SymbolTable)
|
||||
*/
|
||||
public Pair<Integer, SSAInstruction> getPi(SSAAbstractInvokeInstruction call, SymbolTable symbolTable) {
|
||||
Pair<Integer, SSAInstruction> result = p1.getPi(call, symbolTable);
|
||||
if (result != null) {
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
package com.ibm.wala.ssa;
|
||||
|
||||
/**
|
||||
* The value of a constant.
|
||||
*
|
||||
* @author sfink
|
||||
* The value of a constant which appears in an SSA IR.
|
||||
*/
|
||||
public class ConstantValue implements Value {
|
||||
final private Object constant;
|
||||
|
|
|
@ -13,19 +13,18 @@ package com.ibm.wala.ssa;
|
|||
import com.ibm.wala.util.debug.Assertions;
|
||||
|
||||
/**
|
||||
* A value generated by a phi instruction
|
||||
* A value generated by a phi instruction.
|
||||
*
|
||||
* @author sfink
|
||||
* Clients shouldn't use this ... it's only used internally during SSA construction.
|
||||
*/
|
||||
public class PhiValue implements Value {
|
||||
class PhiValue implements Value {
|
||||
/**
|
||||
* The phi instruction that defines this value
|
||||
*/
|
||||
final private SSAPhiInstruction phi;
|
||||
|
||||
/**
|
||||
* @param phi
|
||||
* The phi instruction that defines this value
|
||||
* @param phi The phi instruction that defines this value
|
||||
*/
|
||||
PhiValue(SSAPhiInstruction phi) {
|
||||
this.phi = phi;
|
||||
|
|
|
@ -14,16 +14,14 @@ import com.ibm.wala.util.collections.Pair;
|
|||
|
||||
/**
|
||||
* The {@link SSABuilder} consults this as an oracle to decide how to insert {@link SSAPiInstruction}s
|
||||
*
|
||||
* @author sjfink
|
||||
*/
|
||||
public interface SSAPiNodePolicy {
|
||||
|
||||
/**
|
||||
* Do we need to introduce a new name for some value immediately after a call?
|
||||
*
|
||||
* If so, returns a pair consisting of the value number needing renaming, and the instruction which should be recorded
|
||||
* as the cause of the pi instruction
|
||||
* If so, returns a pair consisting of the value number needing renaming, and the instruction which should be recorded as the
|
||||
* cause of the pi instruction
|
||||
*
|
||||
* @param call the call instruction in question
|
||||
* @param symbolTable current state of the symbol table for the IR under construction
|
||||
|
@ -32,11 +30,10 @@ public interface SSAPiNodePolicy {
|
|||
Pair<Integer, SSAInstruction> getPi(SSAAbstractInvokeInstruction call, SymbolTable symbolTable);
|
||||
|
||||
/**
|
||||
* Do we need to introduce a new name for some value after deciding on an outcome for a conditional branch
|
||||
* instruction?
|
||||
* Do we need to introduce a new name for some value after deciding on an outcome for a conditional branch instruction?
|
||||
*
|
||||
* If so, returns a pair consisting of the value number needing renaming, and the instruction which should be recorded
|
||||
* as the cause of the pi instruction
|
||||
* If so, returns a pair consisting of the value number needing renaming, and the instruction which should be recorded as the
|
||||
* cause of the pi instruction
|
||||
*
|
||||
* @param cond the conditional branch instruction in question
|
||||
* @param def1 the {@link SSAInstruction} that defs cond.getUse(0), or null if none
|
||||
|
|
|
@ -11,15 +11,25 @@
|
|||
package com.ibm.wala.ssa;
|
||||
|
||||
/**
|
||||
* @author sfink
|
||||
*
|
||||
* Representation of a particular value which appears in an SSA IR.
|
||||
*
|
||||
* Clients probably shouldn't use this; it's only public (for now) due to Java's package-based weak module system.
|
||||
*/
|
||||
public interface Value {
|
||||
|
||||
/**
|
||||
* Is this value a string constant?
|
||||
*/
|
||||
public boolean isStringConstant();
|
||||
|
||||
/**
|
||||
* Is this value a null constant?
|
||||
*/
|
||||
public boolean isNullConstant();
|
||||
|
||||
/**
|
||||
* TODO: what is this???? It's only used by CAst....
|
||||
*/
|
||||
public int getDefaultValue(SymbolTable symtab);
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue