Package soot.shimple.internal
Class SPhiExpr
- java.lang.Object
-
- soot.shimple.internal.SPhiExpr
-
- All Implemented Interfaces:
Serializable,EquivTo,Expr,PhiExpr,ShimpleExpr,UnitBoxOwner,Switchable,Value
public class SPhiExpr extends Object implements PhiExpr
Internal implementation of Phi nodes.- Author:
- Navindra Umanee
- See Also:
PhiExpr, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<ValueUnitPair>argPairsprotected intblockIdprotected Map<Unit,ValueUnitPair>predToPairprotected Typetype
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddArg(Value arg, Block pred)Add the given argument associated with the given CFG predecessor.booleanaddArg(Value arg, Unit predTailUnit)Add the given argument associated with the given CFG predecessor.voidapply(Switch sw)Called when this object is visited.voidclearUnitBoxes()Objectclone()Returns a clone of this Value.intequivHashCode()Returns a (not necessarily fixed) hash code for this object.booleanequivTo(Object o)Returns true if this object is equivalent to o.ValueUnitPairgetArgBox(int index)Returns the argument pair for the given index.ValueUnitPairgetArgBox(Block pred)Returns the argument pair corresponding to the given CFG predecessor.ValueUnitPairgetArgBox(Unit predTailUnit)Returns the argument pair corresponding to the given CFG predecessor.intgetArgCount()Returns the number of arguments in this PhiExpr.intgetArgIndex(Block pred)Returns the index of the argument associated with the given control flow predecessor.intgetArgIndex(Unit predTailUnit)Returns the index of the argument associated with the given control flow predecessor Unit.List<ValueUnitPair>getArgs()Returns an unmodifiable, backed view of the arguments to this PhiExpr.intgetBlockId()Returns the id number of the block from which the Phi node originated from.UnitgetPred(int index)Returns the control flow predecessor Unit for the given index into the PhiExpr.List<Unit>getPreds()Returns a list of the control flow predecessor Units being tracked by this PhiExprTypegetType()Returns the Soot type of this Value.List<UnitBox>getUnitBoxes()List<ValueBox>getUseBoxes()Returns a List of boxes corresponding to Values which are used by (ie contained within) this Value.ValuegetValue(int index)Returns the value for the given index into the PhiExpr.ValuegetValue(Block pred)Get the PhiExpr argument corresponding to the given control flow predecessor, returns null if not available.ValuegetValue(Unit predTailUnit)Get the PhiExpr argument corresponding to the given control flow predecessor, returns null if not available.List<Value>getValues()Returns a list of the values used by this PhiExpr.booleanremoveArg(int index)Remove the argument at the given index.booleanremoveArg(Block pred)Remove the argument corresponding to the given CFG predecessor.booleanremoveArg(ValueUnitPair arg)Remove the given argument.booleanremoveArg(Unit predTailUnit)Remove the argument corresponding to the given CFG predecessor.booleansetArg(int index, Value arg, Block pred)Modify the PhiExpr argument at the given index with the given information.booleansetArg(int index, Value arg, Unit predTailUnit)Modify the PhiExpr argument at the given index with the given information.voidsetBlockId(int blockId)Set the block number of the Phi node.booleansetPred(int index, Block pred)Update the CFG predecessor associated with the PhiExpr argument at the given index.booleansetPred(int index, Unit predTailUnit)Update the CFG predecessor associated with the PhiExpr argument at the given index.booleansetValue(int index, Value arg)Set the value at the given index into the PhiExpr.booleansetValue(Block pred, Value arg)Locate the argument associated with the given CFG predecessor and set the value.booleansetValue(Unit predTailUnit, Value arg)Locate the argument associated with the given CFG predecessor unit and set the value.StringtoString()voidtoString(UnitPrinter up)protected voidupdateCache()Update predToPair cache map which could be out-of-sync due to external setUnit or clone operations on the UnitBoxes.
-
-
-
Field Detail
-
argPairs
protected List<ValueUnitPair> argPairs
-
predToPair
protected Map<Unit,ValueUnitPair> predToPair
-
type
protected Type type
-
blockId
protected int blockId
-
-
Method Detail
-
getArgs
public List<ValueUnitPair> getArgs()
Description copied from interface:PhiExprReturns an unmodifiable, backed view of the arguments to this PhiExpr. Each argument is a ValueUnitPair.- Specified by:
getArgsin interfacePhiExpr- See Also:
ValueUnitPair
-
getValues
public List<Value> getValues()
Description copied from interface:PhiExprReturns a list of the values used by this PhiExpr.
-
getPreds
public List<Unit> getPreds()
Description copied from interface:PhiExprReturns a list of the control flow predecessor Units being tracked by this PhiExpr
-
getArgCount
public int getArgCount()
Description copied from interface:PhiExprReturns the number of arguments in this PhiExpr.- Specified by:
getArgCountin interfacePhiExpr
-
getArgBox
public ValueUnitPair getArgBox(int index)
Description copied from interface:PhiExprReturns the argument pair for the given index. Null if out-of-bounds.
-
getValue
public Value getValue(int index)
Description copied from interface:PhiExprReturns the value for the given index into the PhiExpr. Null if out-of-bounds.
-
getPred
public Unit getPred(int index)
Description copied from interface:PhiExprReturns the control flow predecessor Unit for the given index into the PhiExpr. Null if out-of-bounds.
-
getArgIndex
public int getArgIndex(Unit predTailUnit)
Description copied from interface:PhiExprReturns the index of the argument associated with the given control flow predecessor Unit. Returns -1 if not found.- Specified by:
getArgIndexin interfacePhiExpr
-
getArgBox
public ValueUnitPair getArgBox(Unit predTailUnit)
Description copied from interface:PhiExprReturns the argument pair corresponding to the given CFG predecessor. Returns null if not found.
-
getValue
public Value getValue(Unit predTailUnit)
Description copied from interface:PhiExprGet the PhiExpr argument corresponding to the given control flow predecessor, returns null if not available.
-
getArgIndex
public int getArgIndex(Block pred)
Description copied from interface:PhiExprReturns the index of the argument associated with the given control flow predecessor. Returns -1 if not found.- Specified by:
getArgIndexin interfacePhiExpr
-
getArgBox
public ValueUnitPair getArgBox(Block pred)
Description copied from interface:PhiExprReturns the argument pair corresponding to the given CFG predecessor. Returns null if not found.
-
getValue
public Value getValue(Block pred)
Description copied from interface:PhiExprGet the PhiExpr argument corresponding to the given control flow predecessor, returns null if not available.
-
setArg
public boolean setArg(int index, Value arg, Unit predTailUnit)Description copied from interface:PhiExprModify the PhiExpr argument at the given index with the given information. Returns false on failure.
-
setArg
public boolean setArg(int index, Value arg, Block pred)Description copied from interface:PhiExprModify the PhiExpr argument at the given index with the given information. Returns false on failure.
-
setValue
public boolean setValue(int index, Value arg)Description copied from interface:PhiExprSet the value at the given index into the PhiExpr. Returns false on failure.
-
setValue
public boolean setValue(Unit predTailUnit, Value arg)
Description copied from interface:PhiExprLocate the argument associated with the given CFG predecessor unit and set the value. Returns false on failure.
-
setValue
public boolean setValue(Block pred, Value arg)
Description copied from interface:PhiExprLocate the argument associated with the given CFG predecessor and set the value. Returns false on failure.
-
setPred
public boolean setPred(int index, Unit predTailUnit)Description copied from interface:PhiExprUpdate the CFG predecessor associated with the PhiExpr argument at the given index. Returns false on failure.
-
setPred
public boolean setPred(int index, Block pred)Description copied from interface:PhiExprUpdate the CFG predecessor associated with the PhiExpr argument at the given index. Returns false on failure.
-
removeArg
public boolean removeArg(int index)
Description copied from interface:PhiExprRemove the argument at the given index. Returns false on failure.
-
removeArg
public boolean removeArg(Unit predTailUnit)
Description copied from interface:PhiExprRemove the argument corresponding to the given CFG predecessor. Returns false on failure.
-
removeArg
public boolean removeArg(Block pred)
Description copied from interface:PhiExprRemove the argument corresponding to the given CFG predecessor. Returns false on failure.
-
removeArg
public boolean removeArg(ValueUnitPair arg)
Description copied from interface:PhiExprRemove the given argument. Returns false on failure.
-
addArg
public boolean addArg(Value arg, Block pred)
Description copied from interface:PhiExprAdd the given argument associated with the given CFG predecessor. Returns false on failure.
-
addArg
public boolean addArg(Value arg, Unit predTailUnit)
Description copied from interface:PhiExprAdd the given argument associated with the given CFG predecessor. Returns false on failure.
-
setBlockId
public void setBlockId(int blockId)
Description copied from interface:PhiExprSet the block number of the Phi node.- Specified by:
setBlockIdin interfacePhiExpr
-
getBlockId
public int getBlockId()
Description copied from interface:PhiExprReturns the id number of the block from which the Phi node originated from.- Specified by:
getBlockIdin interfacePhiExpr
-
updateCache
protected void updateCache()
Update predToPair cache map which could be out-of-sync due to external setUnit or clone operations on the UnitBoxes.
-
equivTo
public boolean equivTo(Object o)
Description copied from interface:EquivToReturns true if this object is equivalent to o.
-
equivHashCode
public int equivHashCode()
Description copied from interface:EquivToReturns a (not necessarily fixed) hash code for this object. This hash code coincides with equivTo; it is undefined in the presence of mutable objects.- Specified by:
equivHashCodein interfaceEquivTo
-
getUnitBoxes
public List<UnitBox> getUnitBoxes()
- Specified by:
getUnitBoxesin interfaceUnitBoxOwner
-
clearUnitBoxes
public void clearUnitBoxes()
- Specified by:
clearUnitBoxesin interfaceUnitBoxOwner
-
getUseBoxes
public List<ValueBox> getUseBoxes()
Description copied from interface:ValueReturns a List of boxes corresponding to Values which are used by (ie contained within) this Value.- Specified by:
getUseBoxesin interfaceValue
-
getType
public Type getType()
Description copied from interface:ValueReturns the Soot type of this Value.
-
toString
public void toString(UnitPrinter up)
-
apply
public void apply(Switch sw)
Description copied from interface:SwitchableCalled when this object is visited.- Specified by:
applyin interfaceSwitchable
-
-