Package com.tonic.analysis.pdg.node
Class PDGRegionNode
- java.lang.Object
-
- com.tonic.analysis.pdg.node.PDGNode
-
- com.tonic.analysis.pdg.node.PDGRegionNode
-
public class PDGRegionNode extends PDGNode
PDG node standing for a control region - entry, exit or a structured region - over a set of covered blocks, defining and using no values.
-
-
Constructor Summary
Constructors Constructor Description PDGRegionNode(int id, PDGNodeType type, String regionName, IRBlock primaryBlock)Creates a region node, seeding the covered set with the primary block when one is given.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCoveredBlock(IRBlock block)Adds a block to the set this region covers.booleancoversBlock(IRBlock block)Tests whether a block is part of this region.static PDGRegionNodecreateEntry(int id, String methodName, IRBlock entryBlock)Creates the entry node for a method, named "ENTRY:" plus the method name.static PDGRegionNodecreateExit(int id, String methodName, IRBlock exitBlock)Creates the exit node for a method, named "EXIT:" plus the method name.static PDGRegionNodecreateRegion(int id, String name, IRBlock block)Creates a plain region node.Set<IRBlock>getCoveredBlocks()SSAValuegetDefinedValue()StringgetLabel()StringgetRegionName()List<Value>getUsedValues()booleanisEntry()booleanisExit()StringtoString()-
Methods inherited from class com.tonic.analysis.pdg.node.PDGNode
addIncomingEdge, addOutgoingEdge, equals, getBlock, getControlDependenceEdges, getDataDependenceEdges, getId, getIncomingEdges, getInDegree, getOutDegree, getOutgoingEdges, getPredecessors, getSuccessors, getTaintLabel, getType, hashCode, hasIncomingEdges, hasOutgoingEdges, isTainted, removeIncomingEdge, removeOutgoingEdge, setBlock, setTainted, setTaintLabel
-
-
-
-
Constructor Detail
-
PDGRegionNode
public PDGRegionNode(int id, PDGNodeType type, String regionName, IRBlock primaryBlock)Creates a region node, seeding the covered set with the primary block when one is given.- Parameters:
id- the node idtype- the node typeregionName- the region name used as the labelprimaryBlock- the block the region starts at, may be null
-
-
Method Detail
-
getRegionName
public String getRegionName()
- Returns:
- the region name
-
createEntry
public static PDGRegionNode createEntry(int id, String methodName, IRBlock entryBlock)
Creates the entry node for a method, named "ENTRY:" plus the method name.- Parameters:
id- the node idmethodName- the method the node headsentryBlock- the entry block, may be null- Returns:
- the new node
-
createExit
public static PDGRegionNode createExit(int id, String methodName, IRBlock exitBlock)
Creates the exit node for a method, named "EXIT:" plus the method name.- Parameters:
id- the node idmethodName- the method the node closesexitBlock- the exit block, may be null- Returns:
- the new node
-
createRegion
public static PDGRegionNode createRegion(int id, String name, IRBlock block)
Creates a plain region node.- Parameters:
id- the node idname- the region nameblock- the block the region starts at- Returns:
- the new node
-
addCoveredBlock
public void addCoveredBlock(IRBlock block)
Adds a block to the set this region covers.- Parameters:
block- the block to cover
-
coversBlock
public boolean coversBlock(IRBlock block)
Tests whether a block is part of this region.- Parameters:
block- the block to test- Returns:
- true if the block is covered
-
getLabel
public String getLabel()
-
getUsedValues
public List<Value> getUsedValues()
- Specified by:
getUsedValuesin classPDGNode- Returns:
- the values this node reads
-
getDefinedValue
public SSAValue getDefinedValue()
- Specified by:
getDefinedValuein classPDGNode- Returns:
- the value this node defines, or null if it defines none
-
isEntry
public boolean isEntry()
- Returns:
- true if this is the entry node
-
isExit
public boolean isExit()
- Returns:
- true if this is the exit node
-
-