# Class: com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG

This class represents a Control Flow Graph for a method, or more generally, any body of code. The CFG can be typed to handle specific [instructions](IInstruction). It is used by the Android plugins specifically, including `dexdec`. \(The native code analysis pipeline, including `gendec`, use another class of CFG components.\) 

 This class provides **Data Flow Analysis** support. A client can request simple and full def\-use\- and use\-def chains. Full chains contain more precise cross\-block information. Reach\-chains are also available. 

 There are two ways to build a CFG: 
 
- By using the [#CFG(Collection)](#CFG(Collection)) constructor with a list of [#buildGraph(List, List)](#buildGraph(List, List)) with a list of [pre\-basic blocks](BasicBlockBuilder).
-  
- By calling the [#CFG(List, List)](#CFG(List, List)) constructor and passing a flat list of instructions.
-  

 

 NOTE: This class is to be used exclusively by the Android components.

## Constructor: CFG
- parameter: `builders`, type: `java.util.Collection<com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlockBuilder<InsnType>>`

Description: Create a CFG using a pre\-computed list of partial basic block.
parameter: builders: pre\-computed basic block builders

## Constructor: CFG
- parameter: `insns`, type: `java.util.List<InsnType>`
- parameter: `irrdata`, type: `java.util.List<com.pnfsoftware.jeb.core.units.code.android.controlflow.IrregularFlowData>`

Description: Create a CFG by recursively parsing a list of instructions.
parameter: insns: list of instructions to be processed
parameter: irrdata: \(optional\) irregular flow information, used for exception support

## Constructor: CFG
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<InsnType>`

Description: Shallow duplication of the current CFG. The graph is reconstructed; the instructions are not duplicated.
parameter: cfg: source graph

## Static Field: cfgfwccnt
Type: `java.util.concurrent.atomic.AtomicInteger`
Description: Performance counter reserved for internal use.

## Method: addBlock
- parameter: `index`, type: `int`
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`

Description: Insert a block, does nothing else. The block is not connected, it is up to client code to connect it.
parameter: index: insertion index; negative values are relative to the end of the block list
parameter: b: block to insert

## Method: addBlock
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`

Description: Add a block, does nothing else. The block is not connected, it is up to client code to connect it.
parameter: b: block to add

## Method: addEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- return type: `boolean`

Description: Append an out\-edge. Duplicates are not allowed.
parameter: x: source block
parameter: y: destination block
return: true if an edge was added, false if one already existed

## Method: addEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `index`, type: `int`
- return type: `int`

Description: Add an out\-edge. Duplicates are allowed.
parameter: x: source block
parameter: y: destination block
parameter: index: position \(negative index is allowed, e.g. \-1 means append last\)
return: the updated number of edges x\-\>y

## Method: addIrregularEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- return type: `boolean`

Description: Connect \(irregularly\) a source block to destination block. This method does NOT allow the addition of duplicate connections. 

 This method should not be used. Use [#addIrregularEdge(BasicBlock, BasicBlock, int)](#addIrregularEdge(BasicBlock, BasicBlock, int)) instead.
parameter: x: source block
parameter: y: destination block
return: true if an edge was added, false if one already existed

## Method: addIrregularEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `index`, type: `int`
- return type: `int`

Description: Connect \(irregularly\) a source block to destination block. This method allows the addition of duplicate connections.
parameter: x: source block
parameter: y: destination
parameter: index: out\-irr.edge index \(negative indices can be used; e.g. \-1 means append\)
return: the updated number of irregular edges x\-to\-y

## Method: addressableInstructions
- return type: `java.lang.Iterable<com.pnfsoftware.jeb.core.units.code.AddressableInstruction<InsnType>>`


## Method: containsInstruction
- parameter: `targetInsn`, type: `InsnType`
- return type: `boolean`

Description: Determine whether the CFG contains the provided instruction.
parameter: targetInsn: instruction
return: true if the instruction is part of the graph

## Method: createDataFlowAnalysisHelperObject
- return type: `com.pnfsoftware.jeb.core.units.code.IDFA<InsnType>`

Description: Create an unmanaged data flow analysis object initialized with this CFG's DFA settings. These objects are not managed by this CFG object. For managed DFA objects, clients should use `doDataFlowAnalysis()` or `#getDataFlowAnalysis()`.
return: new unmanaged data flow analysis helper object

## Method: deleteEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- return type: `boolean`

Description: Delete an edge x\-\>y. If duplicates exist, the first one in the list of out\-edges is deleted.
parameter: x: source block
parameter: y: destination block
return: true if x\-\>y existed and was deleted

## Method: deleteEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `xToYPos`, type: `int`
- return type: `int`

Description: Delete an edge x\-\>y.
parameter: x: source block
parameter: y: destination block
parameter: xToYPos: position of the edge to delete among duplicate edges
return: the number of deleted edges

## Method: deleteEdges
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- return type: `int`

Description: Delete all regular edges from one block to another.
parameter: x: source block
parameter: y: destination block
return: the number of deleted edges

## Method: deleteIrregularEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- return type: `boolean`

Description: Delete an irregular edge x\-\>y. If duplicates exist, the first one in the list of irrout\-edges is deleted.
parameter: x: source block
parameter: y: destination block
return: true if x\-\>y existed and was deleted

## Method: deleteIrregularEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `xToYPos`, type: `int`
- return type: `int`

Description: Delete an irregular edge x\-\>y.
parameter: x: source block
parameter: y: destination block
parameter: xToYPos: position of the edge to delete among duplicate irregular edges
return: the number of deleted irregular edges

## Method: deleteIrregularEdges
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- return type: `int`

Description: Delete all irregular edges from one block to another.
parameter: x: source block
parameter: y: destination block
return: the number of deleted irregular edges

## Method: deleteIrregularOutEdges
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`

Description: Delete all irregular output edges for the provided block.
parameter: b: block

## Method: deleteOutEdges
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`

Description: Delete all regular output edges for the provided block.
parameter: b: block

## Method: doDataFlowAnalysis
- return type: `com.pnfsoftware.jeb.core.units.code.IDFA<InsnType>`

Description: Create or retrieve a DFA object with current settings.
return: a DFA object

## Method: doDataFlowAnalysis
- parameter: `redo`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.IDFA<InsnType>`

Description: Create or retrieve a DFA object with current settings.
parameter: redo: if true, force a new analysis even if one is not required
return: a DFA object

## Method: doDataFlowAnalysis
- parameter: `redo`, type: `boolean`
- parameter: `varCollectionFlags`, type: `int`
- parameter: `integrateCalculatedInputRegisters`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.IDFA<InsnType>`

Description: Create or retrieve a DFA object.
parameter: redo: if true, force a new analysis even if one is not required
parameter: varCollectionFlags: variable collection flags
parameter: integrateCalculatedInputRegisters: if true, the live registers determined after            analysis will be integrated in the use\-def chains
return: a DFA object

## Method: format
- return type: `java.lang.String`

Description: Format the CFG into a printable string. Instruction addresses are included, edges are appended to the CFG.
return: formatted CFG string

## Method: format
- parameter: `format_addresses`, type: `boolean`
- parameter: `format_edgelists`, type: `boolean`
- parameter: `context`, type: `java.lang.Object`
- return type: `java.lang.String`

Description: Format the CFG into a printable string.
parameter: format_addresses: true to prepend instructions by their addresses
parameter: format_edgelists: true to append the explicit list of edges to the CFG
parameter: context: optional formatting context
return: formatted CFG string

## Method: formatEdges
- return type: `java.lang.String`

Description: Format the edges of this CFG to a string.
return: a two\-line string with the list of regular edges and irregular edges

## Method: generateIrregularFlowDataObjects
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.android.controlflow.IrregularFlowData>`

Description: \(Re\-\)generate the irregular control flow information present in this CFG.
return: generated irregular flow data objects

## Method: get
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`


## Method: getAddressBlockMap
- return type: `java.util.TreeMap<java.lang.Long,com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>>`

Description: Get a complete map of the basic blocks and their addresses in the CFG. This method is recommended for use when multiple, repeated invocations of [#getBlockAt(int)](#getBlockAt(int)) are to be made.
return: a map of address\-\>block

## Method: getBlock
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`


## Method: getBlockAt
- parameter: `address`, type: `long`
- return type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`


## Method: getBlockByLastAddress
- parameter: `lastAddress`, type: `long`
- return type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`


## Method: getBlockContaining
- parameter: `address`, type: `long`
- return type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`


## Method: getBlockEndingAt
- parameter: `address`, type: `long`
- return type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`


## Method: getBlockFor
- parameter: `insn`, type: `InsnType`
- return type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`

Description: Search an instruction by reference. This method's performance is sub\-optimal. 

 This method is not the same as `getBlockAt(insn.getOffset())`.
parameter: insn: instruction reference
return: containing block, or null if the instruction is not part of this CFG

## Method: getBlockIndex
- parameter: `address`, type: `long`
- return type: `int`

Description: Get the index of the basic block starting at the provided address.
parameter: address: block start address
return: the block index, or \-1 if none starts at the address

## Method: getBlocks
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>>`


## Method: getBlocksView
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>>`


## Method: getCurrentDFAs
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.IDFA<InsnType>>`

Description: Retrieve a list of all managed data flow analysis objects.
return: list of current managed data flow analysis objects

## Method: getDFADefaultCollectionFlags
- return type: `int`

Description: Note that the initial value is set to [DFA4#STANDARD_COLLECTION_FLAGS](DFA4#STANDARD_COLLECTION_FLAGS).
return: current default collection flags

## Method: getDataFlowAnalysis
- return type: `com.pnfsoftware.jeb.core.units.code.IDFA<InsnType>`

Description: Retrieve a valid DFA object done with standard parameters \(conservative, with inputs, no copies\).
return: a DFA object, null if no valid matching DFA object is retrieved

## Method: getDataFlowAnalysis
- parameter: `varCollectionFlags`, type: `int`
- parameter: `integrateCalculatedInputRegisters`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.IDFA<InsnType>`

Description: Retrieve a valid DFA object matching the provided parameters.
parameter: varCollectionFlags: variable collection flags
parameter: integrateCalculatedInputRegisters: if true, the live registers determined after            analysis will be integrated in the use\-def chains
return: a DFA object, null if no valid matching DFA object is retrieved

## Method: getEffectiveSize
- return type: `int`


## Method: getEndAddress
- return type: `long`


## Method: getEntryAddress
- return type: `long`


## Method: getEntryBlock
- return type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`


## Method: getExitBlocks
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>>`


## Method: getFirstAddress
- return type: `long`


## Method: getGraphRepresentation
- parameter: `edges`, type: `java.util.List<int[]>`
- parameter: `irregularEdges`, type: `java.util.List<int[]>`


## Method: getInstruction
- parameter: `address`, type: `long`
- return type: `InsnType`


## Method: getInstructionAt
- parameter: `address`, type: `long`
- return type: `InsnType`

Description: Get the instruction located at the provided address.
parameter: address: instruction address
return: the instruction, or null if none is located at the address

## Method: getInstructionCount
- return type: `int`


## Method: getInstructionLocation
- parameter: `address`, type: `long`
- return type: `com.pnfsoftware.jeb.util.base.Couple<com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>,java.lang.Integer>`


## Method: getInstructionLocation
- parameter: `address`, type: `long`
- parameter: `precise`, type: `boolean`
- return type: `com.pnfsoftware.jeb.util.base.Couple<com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>,java.lang.Integer>`

Description: Locate an instruction.
parameter: address: instruction address
parameter: precise: if true, the instruction is expected to start at the provided address; else,            the provided address may address any byte of the instruction
return: a couple \(basic block, instruction index within that block\); null on error

## Method: getInstructionSet
- return type: `java.util.TreeMap<java.lang.Long,InsnType>`

Description: Retrieve an ordered dictionary of instructions.
return: key= offset, value= instruction at offset

## Method: getInstructions
- return type: `java.util.List<InsnType>`


## Method: getLast
- return type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`


## Method: getLastAddress
- return type: `long`


## Method: getVariableInformationProvider
- return type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.IVariableInformationProvider`

Description: Get the variable information provider used by data\-flow analyses.
return: the current provider, or null if none is set

## Method: handlers
- return type: `java.lang.Iterable<com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>>`

Description: Iterate over exception handler blocks.
return: iterable over handler blocks

## Method: hasExit
- return type: `boolean`

Description: Determine if this CFG has exit blocks, that is, blocks without out\-edges.
return: true if at least one exit block exists

## Method: hasNoExit
- return type: `boolean`

Description: Determine if this CFG does not have any exit block.
return: true if no exit block exists

## Method: indexOf
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- return type: `int`


## Method: instructions
- return type: `java.lang.Iterable<InsnType>`


## Method: instructions
- parameter: `fromAddress`, type: `long`
- return type: `java.lang.Iterable<InsnType>`

Description: Iterate over a range of instructions of this CFG.
parameter: fromAddress: exact address of the first instruction to be iterated over
return: iterable over instructions starting at the requested address

## Method: invalidateDataFlowAnalysis

Description: Invalidate all previously performed data flow analyses. This method can be used after a CFG modification that would render DFA objects obsoletes.

## Method: invalidateDataFlowAnalysis
- parameter: `addressOfInstructionChange`, type: `long`

Description: Partially invalidate data flow analyses. This method can be used after modifying an instruction of the CFG.
parameter: addressOfInstructionChange: address

## Method: isDFADefaultIntegrateInputs
- return type: `boolean`

Description: Note that the initial value is set to [DFA4#STANDARD_INTEGRATE_INPUTS](DFA4#STANDARD_INTEGRATE_INPUTS).
return: current default input integration setting

## Method: iterator
- return type: `java.util.Iterator<com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>>`


## Method: reconnectEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `z`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- return type: `int`

Description: This method reconnects a block x from y to z, i.e. x\-\>y becomes x\-\>z. Duplicates edges are forbidden. 

 See [#reconnectEdge(BasicBlock, BasicBlock, BasicBlock, Integer)](#reconnectEdge(BasicBlock, BasicBlock, BasicBlock, Integer)).
parameter: x: source block
parameter: y: current destination block
parameter: z: new destination block, or null to delete the edge
return: the number of reconnected edges

## Method: reconnectEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `z`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `xToYPos`, type: `java.lang.Integer`
- return type: `int`

Description: This method reconnects a block x from y to z, i.e. x\-\>y becomes x\-\>z. If z is null, this method deletes the edge x\>y.
parameter: x: source block
parameter: y: original destination block
parameter: z: new destination block; null to indicate that the edge x\>y should be deleted
parameter: xToYPos: optional index specifying which x\>y edge \(if there are more than one\) should            be picked \(this index is not an index into the full out\-list of x\); if null, this            method will fail on duplicate edges \(see return codes\)
return: \+1: success
         0: failure, x\-\>y does not exist
         \-1: failure, a edge x\-\>z already exists, and duplicate edges are never allowed
         \-2: failure, multiple edges x\-\>y were found

## Method: reconnectEdges
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `z`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- return type: `int`

Description: Reconnect all regular edges from one destination to another.
parameter: x: source block
parameter: y: current destination block
parameter: z: new destination block, or null to delete the edges
return: the number of reconnected edges

## Method: reconnectIrregularEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `z`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- return type: `int`

Description: This method irregularly reconnects a block x from y to z, i.e. x\-\>y becomes x\-\>z. Duplicates edges are forbidden. 

 See [#reconnectIrregularEdge(BasicBlock, BasicBlock, BasicBlock, Integer)](#reconnectIrregularEdge(BasicBlock, BasicBlock, BasicBlock, Integer)).
parameter: x: source block
parameter: y: current destination block
parameter: z: new destination block, or null to delete the edge
return: the number of reconnected irregular edges

## Method: reconnectIrregularEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `z`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `xToYPos`, type: `java.lang.Integer`
- return type: `int`

Description: This method irregularly reconnects a block x from y to z, i.e. x\-\>y becomes x\-\>z. If z is null, this method deletes the irregular edge x\>y.
parameter: x: source block
parameter: y: original destination block
parameter: z: new destination block; null to indicate that the irregular edge x\>y should be            deleted
parameter: xToYPos: optional index specifying which x\>y irregular edge \(if there are more than            one\) should be picked \(this index is not an index into the full irrout\-list of x\);            if null, this method will fail on duplicate irregular edges \(see return codes\); a            negative index can be used to specify a block starting from the list's end \(e.g.            \-2 will mean the second\-to\-last destination y\)
return: \+1: success
         0: failure, x\-\>y does not exist
         \-1: failure, a edge x\-\>z already exists, and duplicate irregular edges are never         allowed
         \-2: failure, multiple irregular edges x\-\>y were found

## Method: reconnectIrregularEdges
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `z`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- return type: `int`

Description: Reconnect all irregular edges from one destination to another.
parameter: x: source block
parameter: y: current destination block
parameter: z: new destination block, or null to delete the edges
return: the number of reconnected irregular edges

## Method: removeBlock
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`

Description: Remove a block \(preferably empty\) and update the fixtures. This method is content\-agnostic \(it does not examine the instructions of the blocks\). This method throws [IllegalStateException](IllegalStateException) on error. 

 Context: a CFG should never contain empty blocks. However, when the CFG is optimized, instructions are removed, and some nodes might end up empty. This transient, stale state is fine as long as the client knows what it is doing and removes the empty block as soon as they're done, before passing it down the processing chain. This method removes empty blocks and updates the edges of connected and connecting blocks. Caveats: 
 
- 1\) The block must be disconnected from the graph or it must have an out\-degree or in\-degree of one, to enable its reconnection. \(Otherwise, stitching up the edges would not be possible.\) The block must not contain irregular inputs. The block should not contain irregular outputs, as they will be discarded upon removal. 
- 2\) Duplicate edges can be introduced. The client should remove them if it doesn't like that. 
- 3\) The fixtures update is instruction\-agnostic. This means that the client is solely responsible regarding the decision to remove an empty block. For instance, the last instruction of the predecessor block should be checked and the client should make sure that removing the block and updating the fixtures is an operation compatible with the semantics of that last instruction.
parameter: b: block to be removed

## Method: removeBlockSafe
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- return type: `boolean`

Description: Remove a block \(preferably empty\) and update the fixtures. This method is content\-agnostic \(it does not examine the instructions of the blocks\). This method returns false on failure. 

 See [#removeBlock(BasicBlock)](#removeBlock(BasicBlock)) for full javadoc.
parameter: b: block to be removed
return: success indicator

## Method: removeDuplicateEdges
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- return type: `int`

Description: Remove duplicate edges \(regular\) from a source block to a destination block.
parameter: x: src block
parameter: y: dst block
return: the number of duplicate edges removed; \-1 if no such edge exists

## Method: removeDuplicateIrregularEdges
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- return type: `int`

Description: Remove duplicate irregular edges from a source block to a destination block.
parameter: x: src block
parameter: y: dst block
return: the number of duplicate edges removed; \-1 if no such edge exists

## Method: reorganizeInputs
- return type: `int`

Description: Reorganize the input block list so that the fallthrough input block, if any, is placed first.
return: the number of reorganizations

## Method: replaceInstruction
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`
- return type: `InsnType`

Description: Replace an instruction. An existing instruction must exist at the provided address. No adjustment is done \(eg, the replaced instruction size is not modified\). It is up to the caller to adjust the instruction in order to keep a valid CFG object.
parameter: address: the target address
parameter: insn: the instruction that will replace the instruction at the provided address
return: null on error, else the instruction that was replaced

## Method: replaceInstructionsInBlock
- parameter: `address`, type: `long`
- parameter: `cnt`, type: `int`
- parameter: `insns`, type: `java.util.Collection<InsnType>`
- return type: `boolean`

Description: Replace a sequence of instructions contained in a single basic block.
parameter: address: start address for replacement
parameter: cnt: number of instructions to be replaced
parameter: insns: new instructions; the total size must be equal to the size of the instructions            being replaced
return: success indicator

## Method: setDFADefaultCollectionFlags
- parameter: `collectionFlags`, type: `int`
- return type: `int`

Description: Note that the initial value is set to [DFA4#STANDARD_COLLECTION_FLAGS](DFA4#STANDARD_COLLECTION_FLAGS).
parameter: collectionFlags: new default collection flags
return: the previously set value

## Method: setDFADefaultIntegrateInputs
- parameter: `integrateInputs`, type: `boolean`
- return type: `boolean`

Description: Note that the initial value is set to [DFA4#STANDARD_INTEGRATE_INPUTS](DFA4#STANDARD_INTEGRATE_INPUTS).
parameter: integrateInputs: true to integrate calculated input registers by default
return: the previously set value

## Method: setVariableInformationProvider
- parameter: `prv`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.IVariableInformationProvider`
- return type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.IVariableInformationProvider`

Description: Set the variable information provider used by data\-flow analyses.
parameter: prv: provider to set, or null to clear it
return: the previously set provider, or null if none was set

## Method: simplify
- return type: `int`

Description: Merge the blocks that can be merged, without changing the flow of the graph. 

 Necessary conditions include: adjacent blocks, first block falls\-through the second one, no block shall have irregular outputs, only the first block may have irregular inputs.
return: number of mergers

## Method: simplifyIrregularFlows
- return type: `int`

Description: Merge blocks that can be merged, taking into accounts irregular flows.
 A follow through may be merged with a block inside a try \(with irregular outedges\) if no instruction within the block can raise.
return: the number of simplifications performed

## Method: size
- return type: `int`


## Method: splitBlock
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType>`

Description: Split a block into two blocks. Note that the newly\-created block will be set up to have the same irregular outputs as the original block.
parameter: b: block to split
parameter: index: index of the "split instruction" in the block; that instruction will be the            first instruction of the newly\-created block
return: the newly\-created block

## Method: toString
- return type: `java.lang.String`


