Class SSACFG.BasicBlock
java.lang.Object
com.ibm.wala.ssa.SSACFG.BasicBlock
- All Implemented Interfaces:
IBasicBlock<SSAInstruction>, ISSABasicBlock, INodeWithNumber, Iterable<SSAInstruction>
- Direct Known Subclasses:
SSACFG.ExceptionHandlerBasicBlock
- Enclosing class:
SSACFG
A Basic Block in an SSA IR
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPhiForLocal(int n, SSAPhiInstruction phi) voidaddPhiForStackSlot(int slot, SSAPhiInstruction phi) voidaddPiForRefAndPath(int n, Object path, SSAPiInstruction pi) booleanTODO: make this more efficient if neededTheSSACFG.ExceptionHandlerBasicBlocksubclass will override this.intMethod getFirstInstructionIndex.intA non-negative integer which serves as an identifier for this node in it's "dominant" graph.intGet the index of the last instruction in the basic block.intEach basic block should have a unique number in its cfggetPhiForLocal(int n) This method is used during SSA construction.getPhiForStackSlot(int slot) This method is used during SSA construction.getPiForRefAndPath(int n, Object path) inthashCode()booleanhasPhi()booleanIs this block marked as a catch block?booleanDoes this block represent the unique entry to aControlFlowGraphbooleanDoes this block represent the unique exit from aControlFlowGraph?iterator()voidremovePhis(Set<SSAPhiInstruction> toRemove) Remove any phis in the set.voidsetGraphNodeId(int number) toString()Methods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
BasicBlock
public BasicBlock(int number)
-
-
Method Details
-
getNumber
public int getNumber()Description copied from interface:IBasicBlockEach basic block should have a unique number in its cfg- Specified by:
getNumberin interfaceIBasicBlock<SSAInstruction>- Returns:
- the basic block's number
-
getFirstInstructionIndex
public int getFirstInstructionIndex()Method getFirstInstructionIndex.- Specified by:
getFirstInstructionIndexin interfaceIBasicBlock<SSAInstruction>- Returns:
- the instruction index for the first instruction in the basic block.
-
isCatchBlock
public boolean isCatchBlock()Is this block marked as a catch block?- Specified by:
isCatchBlockin interfaceIBasicBlock<SSAInstruction>- Specified by:
isCatchBlockin interfaceISSABasicBlock- Returns:
- true if the basic block represents a catch block.
-
getLastInstructionIndex
public int getLastInstructionIndex()Description copied from interface:IBasicBlockGet the index of the last instruction in the basic block. The value is an index into the instruction array that contains all the instructions for the method.If the result is < 0, the block has no instructions
- Specified by:
getLastInstructionIndexin interfaceIBasicBlock<SSAInstruction>- Returns:
- the instruction index for the last instruction in the basic block
-
iteratePhis
- Specified by:
iteratePhisin interfaceISSABasicBlock- Returns:
- the phi instructions incoming to this block
-
getPhiForStackSlot
This method is used during SSA construction. -
getPhiForLocal
This method is used during SSA construction. -
addPhiForStackSlot
-
addPhiForLocal
-
removePhis
Remove any phis in the set. -
getPiForRefAndPath
-
addPiForRefAndPath
- Parameters:
n- can be the val in the pi instructionpath- can be the successor block in the pi instruction
-
iteratePis
- Specified by:
iteratePisin interfaceISSABasicBlock- Returns:
- the pi instructions incoming to this block
-
iterateNormalInstructions
-
getAllInstructions
TODO: make this more efficient if needed -
iterator
- Specified by:
iteratorin interfaceIterable<SSAInstruction>
-
hasPhi
public boolean hasPhi()- Returns:
- true iff this basic block has at least one phi
-
getGraphNodeId
public int getGraphNodeId()Description copied from interface:INodeWithNumberA non-negative integer which serves as an identifier for this node in it's "dominant" graph. Initially this number is -1; a NumberedGraph will set it to a non-negative value when this node is inserted into the graph- Specified by:
getGraphNodeIdin interfaceINodeWithNumber- Returns:
- the identifier
- See Also:
-
setGraphNodeId
public void setGraphNodeId(int number) - Specified by:
setGraphNodeIdin interfaceINodeWithNumber- See Also:
-
toString
-
equals
-
getMethod
- Specified by:
getMethodin interfaceIBasicBlock<SSAInstruction>- Returns:
- governing method for this block
-
hashCode
-
isExitBlock
public boolean isExitBlock()Description copied from interface:ISSABasicBlockDoes this block represent the unique exit from aControlFlowGraph?- Specified by:
isExitBlockin interfaceIBasicBlock<SSAInstruction>- Specified by:
isExitBlockin interfaceISSABasicBlock- Returns:
- true if the basic block represents the unique exit block.
- See Also:
-
isEntryBlock
public boolean isEntryBlock()Description copied from interface:ISSABasicBlockDoes this block represent the unique entry to aControlFlowGraph- Specified by:
isEntryBlockin interfaceIBasicBlock<SSAInstruction>- Specified by:
isEntryBlockin interfaceISSABasicBlock- Returns:
- true if the basic block represents the unique entry block.
- See Also:
-
getLastInstruction
- Specified by:
getLastInstructionin interfaceISSABasicBlock- Returns:
- the last instruction in this block.
-
getCaughtExceptionTypes
TheSSACFG.ExceptionHandlerBasicBlocksubclass will override this.- Specified by:
getCaughtExceptionTypesin interfaceISSABasicBlock- Returns:
- the set of exception types this block may catch.
-