public class SSAToStatIVisitor
extends java.lang.Object
implements com.ibm.wala.ssa.SSAInstruction.IVisitor
Modifier and Type | Field and Description |
---|---|
private java.util.Map<PhiEdge,java.util.List<PhiCondition>> |
blockConditionMap
A map that maps a PhiEdge with a list of all conditions that describe the path needs to be taken in the cfg to get to that edge of the phi.
|
boolean |
canVeritest
Used to indicate instructions that cannot be veritested.
|
private com.ibm.wala.ssa.ISSABasicBlock |
currentBlock
current block where the instruction lies.
|
private java.util.Deque<PhiCondition> |
currentCondition
Corresponds to the current condition during walking the CFG.
|
private com.ibm.wala.ssa.IR |
ir
IR of the region currently being translated to RangerIR Statement.
|
private StaticRegionException |
pending
Used to throw Static Region Exception.
|
static StaticRegionException |
sre |
Stmt |
veriStatement
A translated RangerIR statement.
|
Constructor and Description |
---|
SSAToStatIVisitor(com.ibm.wala.ssa.IR ir,
com.ibm.wala.ssa.ISSABasicBlock currentBlock,
java.util.Map<PhiEdge,java.util.List<PhiCondition>> blockConditionMap,
java.util.Deque<PhiCondition> currentCondition) |
Modifier and Type | Method and Description |
---|---|
void |
adjustForDepth(java.util.List<java.util.LinkedList<PhiCondition>> conds)
Used to ignore the "out of scope" conditions corresponding to ancestor branches, if this is a phi is for a nested if/then/else,
|
private za.ac.sun.cs.green.expr.Expression |
conjunct(java.util.List<za.ac.sun.cs.green.expr.Expression> le) |
Stmt |
convert(com.ibm.wala.ssa.SSAInstruction ssa) |
private za.ac.sun.cs.green.expr.Expression |
createGamma(java.util.List<java.util.LinkedList<PhiCondition>> conds,
java.util.List<za.ac.sun.cs.green.expr.Expression> values)
Creates Gamma Expression by visiting corresponding Phi
|
private za.ac.sun.cs.green.expr.Expression |
getAndCheckCondition(java.util.List<java.util.LinkedList<PhiCondition>> conds) |
Stmt |
translatePhi(com.ibm.wala.ssa.SSAPhiInstruction ssaphi)
Translates a phi to RangerIR assignment statement of a Gamma expression.
|
void |
visitArrayLength(com.ibm.wala.ssa.SSAArrayLengthInstruction ssaArrayLengthInstruction)
Creates RangerIR array length instruction out of SSA array length instruction.
|
void |
visitArrayLoad(com.ibm.wala.ssa.SSAArrayLoadInstruction ssaArrayLoadInstruction)
Create an ArrayLoad Instruction in RangerIR.
|
void |
visitArrayStore(com.ibm.wala.ssa.SSAArrayStoreInstruction ssaArrayStoreInstruction)
Create an ArrayStore Instruction in RangerIR.
|
void |
visitBinaryOp(com.ibm.wala.ssa.SSABinaryOpInstruction ssa)
Create an Assignment Statement in RangerIR for binary operations in Wala.
|
void |
visitCheckCast(com.ibm.wala.ssa.SSACheckCastInstruction ssaCheckCastInstruction)
Creates RangerIR check cast instruction out of SSA check cast instruction.
|
void |
visitComparison(com.ibm.wala.ssa.SSAComparisonInstruction ssa)
Translates a comparision instruction in Wala SSA to RangerIR assignment statement.
|
void |
visitConditionalBranch(com.ibm.wala.ssa.SSAConditionalBranchInstruction ssa) |
void |
visitConversion(com.ibm.wala.ssa.SSAConversionInstruction ssa)
Casts in SPF involving object creation are beyond what we can support currently in Static regions,
else emulate the type casting between primitive types
|
void |
visitGet(com.ibm.wala.ssa.SSAGetInstruction ssaGetInstruction)
Creates RangerIR get instruction out of SSA get instruction.
|
void |
visitGetCaughtException(com.ibm.wala.ssa.SSAGetCaughtExceptionInstruction ssaGetCaughtExceptionInstruction)
RangerIR does not support getCaughtException.
|
void |
visitGoto(com.ibm.wala.ssa.SSAGotoInstruction ssaGotoInstruction)
Goto instructions are not translated to RangerIR and therefore should not be visited by this visitor.
|
void |
visitInstanceof(com.ibm.wala.ssa.SSAInstanceofInstruction ssaInstanceofInstruction)
Creates RangerIR instance of instruction out of SSA instance of instruction.
|
void |
visitInvoke(com.ibm.wala.ssa.SSAInvokeInstruction ssaInvokeInstruction)
Creates RangerIR invoke instruction out of SSA invoke instruction.
|
void |
visitLoadMetadata(com.ibm.wala.ssa.SSALoadMetadataInstruction ssaLoadMetadataInstruction)
RangerIR does not support SSALoadMeta data instruction.
|
void |
visitMonitor(com.ibm.wala.ssa.SSAMonitorInstruction ssaMonitorInstruction)
RangerIR currently does not support SSAMonitor instructions.
|
void |
visitNew(com.ibm.wala.ssa.SSANewInstruction ssaNewInstruction)
Creates RangerIR new instruction out of SSA new instruction.
|
void |
visitPhi(com.ibm.wala.ssa.SSAPhiInstruction ssaPhiInstruction)
Creates RangerIR phi instruction out of Wala's phi instruction.
|
void |
visitPi(com.ibm.wala.ssa.SSAPiInstruction ssaPiInstruction)
Ranger IR does not need to support Wala's Pi instruction.
|
void |
visitPut(com.ibm.wala.ssa.SSAPutInstruction ssaPutInstruction)
Creates RangerIR put instruction out of SSA put instruction.
|
void |
visitReturn(com.ibm.wala.ssa.SSAReturnInstruction ssaReturnInstruction)
Creates RangerIR return instruction out of SSA return instruction.
|
void |
visitSwitch(com.ibm.wala.ssa.SSASwitchInstruction ssaSwitchInstruction)
RangerIR currently does not support Switch instruction.
|
void |
visitThrow(com.ibm.wala.ssa.SSAThrowInstruction ssaThrowInstruction)
Creates RangerIR throw instruction out of SSA throw instruction.
|
void |
visitUnaryOp(com.ibm.wala.ssa.SSAUnaryOpInstruction ssa)
Translates a unary instruction in Wala SSA to RangerIR assignment statement.
|
public Stmt veriStatement
public boolean canVeritest
private com.ibm.wala.ssa.IR ir
private java.util.Map<PhiEdge,java.util.List<PhiCondition>> blockConditionMap
private java.util.Deque<PhiCondition> currentCondition
private com.ibm.wala.ssa.ISSABasicBlock currentBlock
private StaticRegionException pending
public static StaticRegionException sre
public SSAToStatIVisitor(com.ibm.wala.ssa.IR ir, com.ibm.wala.ssa.ISSABasicBlock currentBlock, java.util.Map<PhiEdge,java.util.List<PhiCondition>> blockConditionMap, java.util.Deque<PhiCondition> currentCondition)
private za.ac.sun.cs.green.expr.Expression conjunct(java.util.List<za.ac.sun.cs.green.expr.Expression> le)
private za.ac.sun.cs.green.expr.Expression getAndCheckCondition(java.util.List<java.util.LinkedList<PhiCondition>> conds)
private za.ac.sun.cs.green.expr.Expression createGamma(java.util.List<java.util.LinkedList<PhiCondition>> conds, java.util.List<za.ac.sun.cs.green.expr.Expression> values) throws StaticRegionException
StaticRegionException
public void adjustForDepth(java.util.List<java.util.LinkedList<PhiCondition>> conds)
conds
- Current out of scope conditions.public Stmt translatePhi(com.ibm.wala.ssa.SSAPhiInstruction ssaphi) throws StaticRegionException
ssaphi
- Current PhiInstruction to be translated.StaticRegionException
- An exception that indicates that something went wrong during translation.public void visitGoto(com.ibm.wala.ssa.SSAGotoInstruction ssaGotoInstruction)
visitGoto
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaGotoInstruction
- public void visitArrayLoad(com.ibm.wala.ssa.SSAArrayLoadInstruction ssaArrayLoadInstruction)
visitArrayLoad
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaArrayLoadInstruction
- Wala SSA instruction for ArrayLoadpublic void visitArrayStore(com.ibm.wala.ssa.SSAArrayStoreInstruction ssaArrayStoreInstruction)
visitArrayStore
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaArrayStoreInstruction
- Wala SSA instruction for ArrayStorepublic void visitBinaryOp(com.ibm.wala.ssa.SSABinaryOpInstruction ssa)
visitBinaryOp
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssa
- Wala SSA binary instruction.public void visitUnaryOp(com.ibm.wala.ssa.SSAUnaryOpInstruction ssa)
visitUnaryOp
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssa
- SSA unary instruction.public void visitConversion(com.ibm.wala.ssa.SSAConversionInstruction ssa)
visitConversion
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
public void visitComparison(com.ibm.wala.ssa.SSAComparisonInstruction ssa)
visitComparison
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssa
- SSA comparision instruction.public void visitConditionalBranch(com.ibm.wala.ssa.SSAConditionalBranchInstruction ssa)
visitConditionalBranch
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
public void visitSwitch(com.ibm.wala.ssa.SSASwitchInstruction ssaSwitchInstruction)
visitSwitch
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaSwitchInstruction
- public void visitReturn(com.ibm.wala.ssa.SSAReturnInstruction ssaReturnInstruction)
visitReturn
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaReturnInstruction
- public void visitGet(com.ibm.wala.ssa.SSAGetInstruction ssaGetInstruction)
visitGet
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaGetInstruction
- public void visitPut(com.ibm.wala.ssa.SSAPutInstruction ssaPutInstruction)
visitPut
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaPutInstruction
- public void visitInvoke(com.ibm.wala.ssa.SSAInvokeInstruction ssaInvokeInstruction)
visitInvoke
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaInvokeInstruction
- public void visitNew(com.ibm.wala.ssa.SSANewInstruction ssaNewInstruction)
visitNew
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaNewInstruction
- public void visitArrayLength(com.ibm.wala.ssa.SSAArrayLengthInstruction ssaArrayLengthInstruction)
visitArrayLength
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaArrayLengthInstruction
- public void visitThrow(com.ibm.wala.ssa.SSAThrowInstruction ssaThrowInstruction)
visitThrow
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaThrowInstruction
- public void visitMonitor(com.ibm.wala.ssa.SSAMonitorInstruction ssaMonitorInstruction)
visitMonitor
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaMonitorInstruction
- public void visitCheckCast(com.ibm.wala.ssa.SSACheckCastInstruction ssaCheckCastInstruction)
visitCheckCast
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaCheckCastInstruction
- public void visitInstanceof(com.ibm.wala.ssa.SSAInstanceofInstruction ssaInstanceofInstruction)
visitInstanceof
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaInstanceofInstruction
- public void visitPhi(com.ibm.wala.ssa.SSAPhiInstruction ssaPhiInstruction)
visitPhi
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaPhiInstruction
- public void visitPi(com.ibm.wala.ssa.SSAPiInstruction ssaPiInstruction)
visitPi
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaPiInstruction
- public void visitGetCaughtException(com.ibm.wala.ssa.SSAGetCaughtExceptionInstruction ssaGetCaughtExceptionInstruction)
visitGetCaughtException
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaGetCaughtExceptionInstruction
- public void visitLoadMetadata(com.ibm.wala.ssa.SSALoadMetadataInstruction ssaLoadMetadataInstruction)
visitLoadMetadata
in interface com.ibm.wala.ssa.SSAInstruction.IVisitor
ssaLoadMetadataInstruction
- public Stmt convert(com.ibm.wala.ssa.SSAInstruction ssa) throws StaticRegionException
StaticRegionException