Package com.tonic.analysis.cpg.node
Class InstructionNode
- java.lang.Object
-
- com.tonic.analysis.cpg.node.CPGNode
-
- com.tonic.analysis.cpg.node.InstructionNode
-
public class InstructionNode extends CPGNode
CPG node wrapping a single IR instruction, positioned by block id and index.
-
-
Constructor Summary
Constructors Constructor Description InstructionNode(long id, IRInstruction instruction, int blockId, int instructionIndex)Creates a node for an IR instruction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetBlockId()IRInstructiongetInstruction()intgetInstructionIndex()StringgetLabel()<T> TgetUnderlying()booleanhasResult()booleanisAllocation()booleanisBranch()booleanisFieldAccess()booleanisInvoke()booleanisPhi()booleanisReturn()booleanisTerminator()StringtoString()-
Methods inherited from class com.tonic.analysis.cpg.node.CPGNode
addIncomingEdge, addOutgoingEdge, astChildren, astParent, cfgPredecessors, cfgSuccessors, controlDependencies, dataDependencies, equals, getEdges, getId, getIncomingEdges, getIncomingEdges, getInDegree, getNodeType, getOutDegree, getOutgoingEdges, getOutgoingEdges, getProperties, getProperty, getTaintLabel, hashCode, hasProperty, isTainted, removeIncomingEdge, removeOutgoingEdge, removeProperty, setProperty, setTainted, setTaintLabel
-
-
-
-
Constructor Detail
-
InstructionNode
public InstructionNode(long id, IRInstruction instruction, int blockId, int instructionIndex)Creates a node for an IR instruction.- Parameters:
id- the unique node idinstruction- the wrapped instructionblockId- the id of the containing blockinstructionIndex- the instruction's position within the block
-
-
Method Detail
-
getInstruction
public IRInstruction getInstruction()
- Returns:
- the instruction
-
getInstructionIndex
public int getInstructionIndex()
- Returns:
- the instruction index
-
getBlockId
public int getBlockId()
- Returns:
- the block id
-
getLabel
public String getLabel()
-
getUnderlying
public <T> T getUnderlying()
- Specified by:
getUnderlyingin classCPGNode- Type Parameters:
T- the expected underlying type- Returns:
- the wrapped IR or analysis object
-
isInvoke
public boolean isInvoke()
- Returns:
- whether the instruction is a method invocation
-
isFieldAccess
public boolean isFieldAccess()
- Returns:
- whether the instruction reads or writes a field
-
isAllocation
public boolean isAllocation()
- Returns:
- whether the instruction allocates an object or array
-
isReturn
public boolean isReturn()
- Returns:
- whether the instruction is a return
-
isBranch
public boolean isBranch()
- Returns:
- whether the instruction is a conditional branch
-
isPhi
public boolean isPhi()
- Returns:
- whether the instruction is a phi
-
hasResult
public boolean hasResult()
- Returns:
- whether the instruction produces a result value
-
isTerminator
public boolean isTerminator()
- Returns:
- whether the instruction ends its block
-
-