Package com.tonic.analysis.pdg.edge
Class PDGEdge
- java.lang.Object
-
- com.tonic.analysis.pdg.edge.PDGEdge
-
public class PDGEdge extends Object
A directed dependence edge in a program dependence graph.
-
-
Constructor Summary
Constructors Constructor Description PDGEdge(PDGNode source, PDGNode target, PDGDependenceType type)Creates an unlabelled edge that carries no value.PDGEdge(PDGNode source, PDGNode target, PDGDependenceType type, SSAValue dependentValue)Creates an unlabelled edge that carries the value flowing along it.PDGEdge(PDGNode source, PDGNode target, PDGDependenceType type, String label)Creates a labelled edge that carries no value.PDGEdge(PDGNode source, PDGNode target, PDGDependenceType type, String label, SSAValue dependentValue, boolean branchCondition)Creates an edge with every attribute given explicitly.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PDGEdgecontrolEdge(PDGNode source, PDGNode target, boolean condition)Creates a control dependence edge for one outcome of a branch.static PDGEdgedataEdge(PDGNode source, PDGNode target, SSAValue value)Creates a def-use data dependence edge.booleanequals(Object o)SSAValuegetDependentValue()StringgetLabel()PDGNodegetSource()PDGNodegetTarget()PDGDependenceTypegetType()StringgetVariable()booleanhasDependentValue()inthashCode()booleanhasLabel()booleanisBranchCondition()booleanisControlDependence()booleanisDataDependence()booleanisInterprocedural()booleanisTainted()static PDGEdgephiEdge(PDGNode source, PDGNode target, SSAValue value, String blockLabel)Creates a data dependence edge feeding one operand of a phi.voidsetTainted(boolean tainted)Marks whether tainted data travels along this edge.StringtoString()
-
-
-
Constructor Detail
-
PDGEdge
public PDGEdge(PDGNode source, PDGNode target, PDGDependenceType type)
Creates an unlabelled edge that carries no value.- Parameters:
source- the depended-upon nodetarget- the dependent nodetype- the dependence kind
-
PDGEdge
public PDGEdge(PDGNode source, PDGNode target, PDGDependenceType type, SSAValue dependentValue)
Creates an unlabelled edge that carries the value flowing along it.- Parameters:
source- the depended-upon nodetarget- the dependent nodetype- the dependence kinddependentValue- the value flowing from source to target
-
PDGEdge
public PDGEdge(PDGNode source, PDGNode target, PDGDependenceType type, String label)
Creates a labelled edge that carries no value.- Parameters:
source- the depended-upon nodetarget- the dependent nodetype- the dependence kindlabel- text shown on the edge
-
PDGEdge
public PDGEdge(PDGNode source, PDGNode target, PDGDependenceType type, String label, SSAValue dependentValue, boolean branchCondition)
Creates an edge with every attribute given explicitly.- Parameters:
source- the depended-upon nodetarget- the dependent nodetype- the dependence kindlabel- text shown on the edge, or nulldependentValue- the value flowing from source to target, or nullbranchCondition- the branch outcome this control edge is taken on
-
-
Method Detail
-
getSource
public PDGNode getSource()
- Returns:
- the source
-
getTarget
public PDGNode getTarget()
- Returns:
- the target
-
getType
public PDGDependenceType getType()
- Returns:
- the type
-
getLabel
public String getLabel()
- Returns:
- the label
-
getDependentValue
public SSAValue getDependentValue()
- Returns:
- the dependent value
-
isBranchCondition
public boolean isBranchCondition()
- Returns:
- whether branch condition
-
isTainted
public boolean isTainted()
- Returns:
- whether tainted
-
setTainted
public void setTainted(boolean tainted)
Marks whether tainted data travels along this edge.- Parameters:
tainted- true if the flow is tainted
-
controlEdge
public static PDGEdge controlEdge(PDGNode source, PDGNode target, boolean condition)
Creates a control dependence edge for one outcome of a branch.- Parameters:
source- the branching nodetarget- the node controlled by the branchcondition- the branch outcome the target is reached on- Returns:
- the control edge
-
dataEdge
public static PDGEdge dataEdge(PDGNode source, PDGNode target, SSAValue value)
Creates a def-use data dependence edge.- Parameters:
source- the defining nodetarget- the using nodevalue- the value that flows- Returns:
- the data edge
-
phiEdge
public static PDGEdge phiEdge(PDGNode source, PDGNode target, SSAValue value, String blockLabel)
Creates a data dependence edge feeding one operand of a phi.- Parameters:
source- the node defining the incoming operandtarget- the phi nodevalue- the incoming valueblockLabel- the predecessor block the operand arrives from- Returns:
- the phi edge
-
isControlDependence
public boolean isControlDependence()
- Returns:
- true if the dependence type is a control dependence
-
isDataDependence
public boolean isDataDependence()
- Returns:
- true if the dependence type is a data dependence
-
isInterprocedural
public boolean isInterprocedural()
- Returns:
- true if the dependence type crosses a procedure boundary
-
hasDependentValue
public boolean hasDependentValue()
- Returns:
- true if a flowing value is attached to this edge
-
hasLabel
public boolean hasLabel()
- Returns:
- true if a non-empty label is attached to this edge
-
getVariable
public String getVariable()
- Returns:
- the name of the flowing value, or null if no value is attached
-
-