Package com.tonic.analysis.pdg.node
Class PDGNode
- java.lang.Object
-
- com.tonic.analysis.pdg.node.PDGNode
-
- Direct Known Subclasses:
PDGInstructionNode,PDGRegionNode,SDGActualInNode,SDGActualOutNode,SDGCallNode,SDGEntryNode,SDGFormalInNode,SDGFormalOutNode
public abstract class PDGNode extends Object
Base node of a program dependence graph, identified by an id and holding its own incoming and outgoing dependence edges plus optional taint marking.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddIncomingEdge(PDGEdge edge)Records an edge arriving at this node, ignoring duplicates.voidaddOutgoingEdge(PDGEdge edge)Records an edge leaving this node, ignoring duplicates.booleanequals(Object o)IRBlockgetBlock()List<PDGEdge>getControlDependenceEdges()List<PDGEdge>getDataDependenceEdges()abstract SSAValuegetDefinedValue()intgetId()List<PDGEdge>getIncomingEdges()intgetInDegree()abstract StringgetLabel()intgetOutDegree()List<PDGEdge>getOutgoingEdges()List<PDGNode>getPredecessors()List<PDGNode>getSuccessors()StringgetTaintLabel()PDGNodeTypegetType()abstract List<Value>getUsedValues()inthashCode()booleanhasIncomingEdges()booleanhasOutgoingEdges()booleanisTainted()voidremoveIncomingEdge(PDGEdge edge)Drops an edge arriving at this node.voidremoveOutgoingEdge(PDGEdge edge)Drops an edge leaving this node.voidsetBlock(IRBlock block)Sets the block this node belongs to.voidsetTainted(boolean tainted)Marks or clears this node as carrying tainted data.voidsetTaintLabel(String taintLabel)Sets the label describing where the taint on this node came from.StringtoString()
-
-
-
Method Detail
-
getId
public int getId()
- Returns:
- the id
-
getType
public PDGNodeType getType()
- Returns:
- the type
-
getBlock
public IRBlock getBlock()
- Returns:
- the block
-
setBlock
public void setBlock(IRBlock block)
Sets the block this node belongs to.- Parameters:
block- the owning block, may be null for region nodes
-
isTainted
public boolean isTainted()
- Returns:
- whether tainted
-
setTainted
public void setTainted(boolean tainted)
Marks or clears this node as carrying tainted data.- Parameters:
tainted- whether the node is tainted
-
getTaintLabel
public String getTaintLabel()
- Returns:
- the taint label
-
setTaintLabel
public void setTaintLabel(String taintLabel)
Sets the label describing where the taint on this node came from.- Parameters:
taintLabel- the taint label
-
getLabel
public abstract String getLabel()
- Returns:
- a short human-readable description of what this node represents
-
getDefinedValue
public abstract SSAValue getDefinedValue()
- Returns:
- the value this node defines, or null if it defines none
-
addIncomingEdge
public void addIncomingEdge(PDGEdge edge)
Records an edge arriving at this node, ignoring duplicates.- Parameters:
edge- the incoming edge
-
addOutgoingEdge
public void addOutgoingEdge(PDGEdge edge)
Records an edge leaving this node, ignoring duplicates.- Parameters:
edge- the outgoing edge
-
removeIncomingEdge
public void removeIncomingEdge(PDGEdge edge)
Drops an edge arriving at this node.- Parameters:
edge- the incoming edge to remove
-
removeOutgoingEdge
public void removeOutgoingEdge(PDGEdge edge)
Drops an edge leaving this node.- Parameters:
edge- the outgoing edge to remove
-
getIncomingEdges
public List<PDGEdge> getIncomingEdges()
- Returns:
- an unmodifiable view of the edges arriving at this node
-
getOutgoingEdges
public List<PDGEdge> getOutgoingEdges()
- Returns:
- an unmodifiable view of the edges leaving this node
-
getPredecessors
public List<PDGNode> getPredecessors()
- Returns:
- the source node of each incoming edge, one entry per edge
-
getSuccessors
public List<PDGNode> getSuccessors()
- Returns:
- the target node of each outgoing edge, one entry per edge
-
getControlDependenceEdges
public List<PDGEdge> getControlDependenceEdges()
- Returns:
- the incoming edges that are control dependences
-
getDataDependenceEdges
public List<PDGEdge> getDataDependenceEdges()
- Returns:
- the incoming edges that are data dependences
-
hasIncomingEdges
public boolean hasIncomingEdges()
- Returns:
- whether any edge arrives at this node
-
hasOutgoingEdges
public boolean hasOutgoingEdges()
- Returns:
- whether any edge leaves this node
-
getInDegree
public int getInDegree()
- Returns:
- the number of incoming edges
-
getOutDegree
public int getOutDegree()
- Returns:
- the number of outgoing edges
-
-