Interface IBasicBlock<InsnType extends IInstruction>

Type Parameters:
InsnType - instruction type
All Superinterfaces:
Iterable<InsnType>
All Known Implementing Classes:
BasicBlock, BasicBlock

public interface IBasicBlock<InsnType extends IInstruction> extends Iterable<InsnType>
Generic interface for CFG's basic block objects.
See Also:
  • Method Details

    • getFirstAddress

      long getFirstAddress()
      Address of first instruction in the block.
      Returns:
      first instruction address
    • getBase

      long getBase()
      Address of first instruction in the block.
      Returns:
      first instruction address
    • getLastAddress

      long getLastAddress()
      Address of last instruction in the block.
      Returns:
      last instruction address
    • getEndAddress

      long getEndAddress()
      Address following the last instruction of the block (ie, last exclusive address).
      Returns:
      end address
    • isEmpty

      boolean isEmpty()
      Determine if the block has 0 instruction.
      Returns:
      true if the block has no instruction
    • size

      int size()
      Get the number of instructions in the block.
      Returns:
      instruction count
    • get

      InsnType get(int index)
      Get the instruction at the specified index.
      Parameters:
      index - instruction index
      Returns:
      instruction
    • getLast

      InsnType getLast()
      Get the last instruction of the block.
      Returns:
      last instruction
    • getInstructions

      List<InsnType> getInstructions()
      Get a copy of the list of instructions that make up this basic block.
      Returns:
      instruction list
    • getSizeOfInstructions

      int getSizeOfInstructions()
      Get the total size of instructions in the block.
      Returns:
      instruction size
    • getAddressOfInstruction

      long getAddressOfInstruction(int index)
      Get the address of an instruction by index.
      Parameters:
      index - instruction index
      Returns:
      instruction address
    • getIndexOfInstruction

      int getIndexOfInstruction(long address)
      Get the index of an instruction by address.
      Parameters:
      address - instruction address
      Returns:
      -1 if there is no instruction starting at the provided address
    • getInstruction

      InsnType getInstruction(long address)
      Get the instruction located at the exact address.
      Parameters:
      address - instruction address
      Returns:
      instruction, or null
    • canThrow

      boolean canThrow()
      Determine whether this block can throw an exception.
      Returns:
      true if the block can throw
    • getOutputBlocks

      List<? extends IBasicBlock<InsnType>> getOutputBlocks()
      Get the regular output blocks.
      Returns:
      a copy of the list of regular output blocks
    • getOutputBlock

      IBasicBlock<InsnType> getOutputBlock(int index)
      Get a regular output block.
      Parameters:
      index - block index
      Returns:
      output block
    • getIrregularOutputBlocks

      List<? extends IBasicBlock<InsnType>> getIrregularOutputBlocks()
      Get irregular output blocks.
      Returns:
      a copy of the list of irregular output blocks
    • getIrregularOutputBlock

      IBasicBlock<InsnType> getIrregularOutputBlock(int index)
      Get an irregular output block.
      Parameters:
      index - block index
      Returns:
      irregular output block
    • getAllOutputBlocks

      List<? extends IBasicBlock<InsnType>> getAllOutputBlocks()
      Get regular and irregular output blocks.
      Returns:
      a copy of the list of all output blocks
    • getOutputs

      List<? extends IBasicBlock<InsnType>> getOutputs()
      Retrieve a read-only list of output blocks (regular).

      NOTE: This method is faster than getOutputBlocks() since it does not provide a copy of the list.

      Returns:
      regular output blocks view
    • getIrregularOutputs

      List<? extends IBasicBlock<InsnType>> getIrregularOutputs()
      Retrieve a read-only list of irregular output blocks.

      NOTE: This method is faster than getIrregularOutputBlocks() since it does not provide a copy of the list.

      Returns:
      irregular output blocks view
    • getAllOutputs

      Iterable<? extends IBasicBlock<InsnType>> getAllOutputs()
      Retrieve a read-only iterable of regular and irregular output blocks.

      NOTE: This method is faster than getAllOutputBlocks() since it does not provide a copy of the list.

      Returns:
      all output blocks view
    • getInputBlocks

      List<? extends IBasicBlock<InsnType>> getInputBlocks()
      Get the regular input blocks.
      Returns:
      a copy of the list of regular input blocks
    • getInputBlock

      IBasicBlock<InsnType> getInputBlock(int index)
      Get a regular input block.
      Parameters:
      index - block index
      Returns:
      a block
    • getIrregularInputBlocks

      List<? extends IBasicBlock<InsnType>> getIrregularInputBlocks()
      Get irregular input blocks.
      Returns:
      a copy of the list of irregular input blocks
    • getIrregularInputBlock

      IBasicBlock<InsnType> getIrregularInputBlock(int index)
      Get an irregular input block.
      Parameters:
      index - block index
      Returns:
      a block
    • getAllInputBlocks

      List<? extends IBasicBlock<InsnType>> getAllInputBlocks()
      Get regular and irregular input blocks.
      Returns:
      a copy of the list of all input blocks
    • getInputs

      List<? extends IBasicBlock<InsnType>> getInputs()
      Retrieve a read-only list of input blocks (regular).

      NOTE: This method is faster than getInputBlocks() since it does not provide a copy of the list.

      Returns:
      regular input blocks view
    • getIrregularInputs

      List<? extends IBasicBlock<InsnType>> getIrregularInputs()
      Retrieve a read-only list of irregular input blocks.

      NOTE: This method is faster than getIrregularInputBlocks() since it does not provide a copy of the list.

      Returns:
      irregular input blocks view
    • getAllInputs

      Iterable<? extends IBasicBlock<InsnType>> getAllInputs()
      Retrieve a read-only iterable of regular and irregular input blocks.

      NOTE: This method is faster than getAllInputBlocks() since it does not provide a copy of the list.

      Returns:
      all input blocks view
    • outsize

      int outsize()
      Get the number of regular output edges from this block.
      Returns:
      regular output edge count
    • irroutsize

      int irroutsize()
      Get the number of irregular output edges from this block.
      Returns:
      irregular output edge count
    • alloutsize

      int alloutsize()
      Get the total number of output edges from this block.
      Returns:
      output edge count
    • insize

      int insize()
      Get the number of regular input edges to this block.
      Returns:
      regular input edge count
    • irrinsize

      int irrinsize()
      Get the number of irregular input edges to this block.
      Returns:
      irregular input edge count
    • allinsize

      int allinsize()
      Get the total number of input edges to this block.
      Returns:
      input edge count