com.ibm.wala.ipa.cfg
Class BasicBlockInContext<T extends ISSABasicBlock>

java.lang.Object
  extended by com.ibm.wala.util.graph.impl.NodeWithNumber
      extended by com.ibm.wala.ipa.cfg.BasicBlockInContext<T>
All Implemented Interfaces:
IBasicBlock<SSAInstruction>, ISSABasicBlock, INodeWithNumber, java.lang.Iterable<SSAInstruction>

public final class BasicBlockInContext<T extends ISSABasicBlock>
extends NodeWithNumber
implements ISSABasicBlock

A helper class to make the ipcfg work correctly with context-sensitive call graphs.


Constructor Summary
BasicBlockInContext(CGNode node, T bb)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.util.Iterator<TypeReference> getCaughtExceptionTypes()
           
 T getDelegate()
           
 int getFirstInstructionIndex()
          Get the index of the first instruction in the basic block.
 SSAInstruction getLastInstruction()
           
 int getLastInstructionIndex()
          Get the index of the last instruction in the basic block.
 IMethod getMethod()
           
 CGNode getNode()
           
 int getNumber()
          Each basic block should have a unique number in its cfg
 int hashCode()
           
 boolean isCatchBlock()
          Return true if the basic block represents a catch block.
 boolean isEntryBlock()
          Return true if the basic block represents the unique entry block.
 boolean isExitBlock()
          Return true if the basic block represents the unique exit block.
 java.util.Iterator<SSAPhiInstruction> iteratePhis()
           
 java.util.Iterator<SSAPiInstruction> iteratePis()
           
 java.util.Iterator<SSAInstruction> iterator()
           
 java.lang.String toString()
           
 
Methods inherited from class com.ibm.wala.util.graph.impl.NodeWithNumber
getGraphNodeId, setGraphNodeId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.wala.util.graph.INodeWithNumber
getGraphNodeId, setGraphNodeId
 

Constructor Detail

BasicBlockInContext

public BasicBlockInContext(CGNode node,
                           T bb)
Method Detail

getFirstInstructionIndex

public int getFirstInstructionIndex()
Description copied from interface: IBasicBlock
Get the index of the first 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:
getFirstInstructionIndex in interface IBasicBlock<SSAInstruction>
Returns:
the instruction index for the first instruction in the basic block.

getLastInstructionIndex

public int getLastInstructionIndex()
Description copied from interface: IBasicBlock
Get 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:
getLastInstructionIndex in interface IBasicBlock<SSAInstruction>
Returns:
the instruction index for the last instruction in the basic block

iterator

public java.util.Iterator<SSAInstruction> iterator()
Specified by:
iterator in interface java.lang.Iterable<SSAInstruction>

getMethod

public IMethod getMethod()
Specified by:
getMethod in interface IBasicBlock<SSAInstruction>
Returns:
governing method for this block

getNumber

public int getNumber()
Description copied from interface: IBasicBlock
Each basic block should have a unique number in its cfg

Specified by:
getNumber in interface IBasicBlock<SSAInstruction>
Returns:
the basic block's number

isCatchBlock

public boolean isCatchBlock()
Description copied from interface: IBasicBlock
Return true if the basic block represents a catch block.

Specified by:
isCatchBlock in interface IBasicBlock<SSAInstruction>
Specified by:
isCatchBlock in interface ISSABasicBlock
Returns:
true if the basic block represents a catch block.

isEntryBlock

public boolean isEntryBlock()
Description copied from interface: IBasicBlock
Return true if the basic block represents the unique entry block.

Specified by:
isEntryBlock in interface IBasicBlock<SSAInstruction>
Specified by:
isEntryBlock in interface ISSABasicBlock
Returns:
true if the basic block represents the unique entry block.

isExitBlock

public boolean isExitBlock()
Description copied from interface: IBasicBlock
Return true if the basic block represents the unique exit block.

Specified by:
isExitBlock in interface IBasicBlock<SSAInstruction>
Specified by:
isExitBlock in interface ISSABasicBlock
Returns:
true if the basic block represents the unique exit block.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getDelegate

public T getDelegate()

getNode

public CGNode getNode()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getCaughtExceptionTypes

public java.util.Iterator<TypeReference> getCaughtExceptionTypes()
Specified by:
getCaughtExceptionTypes in interface ISSABasicBlock
Returns:
the set of exception types this block may catch.

getLastInstruction

public SSAInstruction getLastInstruction()
Specified by:
getLastInstruction in interface ISSABasicBlock
Returns:
the last instruction in this block.

iteratePhis

public java.util.Iterator<SSAPhiInstruction> iteratePhis()
Specified by:
iteratePhis in interface ISSABasicBlock
Returns:
the phi instructions incoming to this block

iteratePis

public java.util.Iterator<SSAPiInstruction> iteratePis()
Specified by:
iteratePis in interface ISSABasicBlock
Returns:
the pi instructions incoming to this block