# Class: com.pnfsoftware.jeb.core.units.code.asm.cfg.CFG

This class represents a Control Flow Graph for a method \(routine\) or any body of code. The CFG can be typed to handle specific [instructions](IInstruction). 

 This class provides basic **Data Flow Analysis** support. A client can request simple and full du\- and ud\-chains. Simple chains are for intra\-block use and reference instructions by index; Full chains contain precise cross\-block information and reference instructions by address. 

 There are two ways to build a CFG: 
 
- Via [#CFG(long, List)](#CFG(long, List)) and providing a list of pre\-parsed [basic blocks](BasicBlock).
-  
- Via [#CFG(List, List)](#CFG(List, List)) and providing a flat list of instructions.
-

## Constructor: CFG
- parameter: `entry`, type: `long`
- parameter: `blocks`, type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>>`

Description: Create a standard CFG using a pre\-constructed list of basic blocks.
parameter: entry: 
parameter: blocks: 

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

Description: Convenience constructor. Same as [CFG\(insns, irrdata, null, 0, 0, 0\)](#CFG(List, List, IInstructionAugmenter, long, long, int)).
parameter: insns: list of **sequential** instructions; they must be contiguous \(no gap\), which            means that the first instruction is at address \`base\`, the second at            \`base\`\+sizeofFirstInstruction, etc.
parameter: irrdata: irregular control flow information

## Constructor: CFG
- parameter: `insns`, type: `java.util.List<? extends InsnType>`
- parameter: `irrdata`, type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.cfg.IrregularFlowData>`
- parameter: `augmenter`, type: `com.pnfsoftware.jeb.core.units.code.asm.analyzer.IInstructionAugmenter`
- parameter: `base`, type: `long`
- parameter: `entry`, type: `long`
- parameter: `flags`, type: `int`

Description: Create a CFG by recursively processing a list of sequential instructions. 

 Delay\-slot instruction sets are not supported by this constructor.
parameter: insns: list of **sequential** instructions; they must be contiguous \(no gap\), which            means that the first instruction is at address \`base\`, the second at            \`base\`\+sizeofFirstInstruction, etc.
parameter: irrdata: irregular control flow information
parameter: augmenter: optional instruction augmenter
parameter: base: routine base address
parameter: entry: routine entry\-point address
parameter: flags: parsing flags, see `FLAG_xxx` constants

## Constructor: CFG
- parameter: `offsetToInsn`, type: `java.util.Map<java.lang.Long,InsnType>`
- parameter: `irrdata`, type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.cfg.IrregularFlowData>`
- parameter: `augmenter`, type: `com.pnfsoftware.jeb.core.units.code.asm.analyzer.IInstructionAugmenter`
- parameter: `entry`, type: `long`
- parameter: `flags`, type: `int`

Description: Create a CFG by recursively processing a collection of instructions. 

 Delay\-slot instruction sets are not supported by this constructor.
parameter: offsetToInsn: map of address\-to\-instructions
parameter: irrdata: irregular control flow information
parameter: augmenter: optional instruction augmenter
parameter: entry: routine entry\-point address
parameter: flags: parsing flags, see `FLAG_xxx` constants

## Field: dfaTotalCount
Type: `int`

## Field: dfaTotalTimeMs
Type: `long`

## Static Field: FLAG_ALLOW_ARTIFICIAL_BLOCK_END
Type: `int`

Constant value: `2`
Description: This flag is used to indicate that blocks may legally end on instructions that are not terminators.

## Static Field: FLAG_ALLOW_UNREACHABLE_BLOCKS
Type: `int`

Constant value: `4`
Description: This flag is used to indicate that the CFG may legally contain blocks not reachable from the entry\-point.

## Static Field: FLAG_SUBROUTINE_CALL_NOT_BREAKING
Type: `int`

Constant value: `1`
Description: This flag is used to specify that `call-to-subroutine` statements are not basic block terminators.

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

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

## Method: addBlock
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.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: 

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

Description: TODO: rename to connect\(\) and SHOULD NOT USE. This method does nothing if such an edge already exists.
parameter: x: 
parameter: y: 
return: true if an edge was added, false if one already existed

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

Description: Add a regular edge X\-\>Y.
parameter: x: source block
parameter: y: destination block
parameter: index: 
return: the updated number of edges x\-\>y

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

Description: TODO: Rename to connectIrregular\(\) and SHOULD NOT USE.
parameter: x: 
parameter: y: 
return: true if an edge was added, false if one already existed

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

Description: 
parameter: x: 
parameter: y: 
parameter: index: 
return: the updated number of irregular edges x\-\>y

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


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

Description: Create a fresh DFA helper object. Clients should use `doDataFlowAnalysis()` methods instead of using this object directly.
return: 

## Method: deleteAllEdges

Description: Remove all block edges.

## Method: deleteDuplicateEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- return type: `boolean`

Description: Delete **one** duplicate edge X\-\>Y.
parameter: x: source block
parameter: y: destination block
return: true if at least 2 edges x\-\>y existed, and one was deleted

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

Description: Delete an edge x\-\>y. If duplicates exist, the first one in the list of out\-edges 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.asm.cfg.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- parameter: `xToYPos`, type: `int`
- return type: `int`

Description: Delete an edge x\-\>y.
parameter: x: 
parameter: y: 
parameter: xToYPos: 
return: 

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

Description: 
parameter: x: 
parameter: y: 
return: the number of deleted edges

## Method: deleteIrregularEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.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.asm.cfg.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- parameter: `xToYPos`, type: `int`
- return type: `int`

Description: Delete an irregular edge x\-\>y.
parameter: x: 
parameter: y: 
parameter: xToYPos: 
return: 

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

Description: 
parameter: x: 
parameter: y: 
return: 

## Method: deleteIrregularOutEdges
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.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.asm.cfg.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: Perform data flow analysis on the CFG using standard DFA settings. Input registers are integrated into the ud\-chains. If possible, the analysis is conservative. Variable\-copies are cleaned. 

 This method does not force a new analysis unless the settings of the last valid analysis do not match the required settings: it is the same as invoking [doDataFlowAnalysis\(false\)](#doDataFlowAnalysis(boolean)).
return: a DFA object

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

Description: Perform data flow analysis on the CFG. Default settings are used if not specified.
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`
- return type: `com.pnfsoftware.jeb.core.units.code.IDFA<InsnType>`

Description: Perform data flow analysis on the CFG. Default settings are used if not specified.
parameter: redo: if true, force a new analysis even if one is not required
parameter: varCollectionFlags: variable collection flags
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: Perform data flow analysis on the CFG.
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: findInstruction
- parameter: `insn`, type: `InsnType`
- return type: `com.pnfsoftware.jeb.core.units.code.AddressableInstruction<InsnType>`

Description: Locate an instruction.
parameter: insn: 
return: 

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

Description: Format this CFG as an assembly\-code listing. 

 *Consider using a [CFGFormatter](CFGFormatter) instead of this method.*
return: the formatted CFG

## 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: formatInstructions
- return type: `java.lang.String`

Description: Format this CFG as an assembly\-code listing. 

 *Consider using a [CFGFormatter](CFGFormatter) instead of this method.*
return: the formatted CFG

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


## Method: getAddressBlockMap
- return type: `java.util.Map<java.lang.Long,com.pnfsoftware.jeb.core.units.code.asm.cfg.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 to block

## Method: getAddressableInstruction
- parameter: `address`, type: `long`
- return type: `com.pnfsoftware.jeb.core.units.code.AddressableInstruction<InsnType>`


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


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


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


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


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


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


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


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

Description: Retrieve a list of all current data flow analyses.
return: 

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

Description: Note that the initial value is set to [IDFA#STANDARD_COLLECTION_FLAGS](IDFA#STANDARD_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.asm.cfg.BasicBlock<InsnType>`


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


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


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

Description: Get the CFG flags. See `FLAG_xxx` in this class.
return: flags

## Method: getGaps
- return type: `java.util.List<com.pnfsoftware.jeb.util.base.Couple<java.lang.Long,java.lang.Long>>`

Description: Get a list of gaps found in the routine CFG. Gaps are memory spaces between blocks that do not belong to the CFG itself. 

 Optimizing compilers and obfuscators can produce routines with gaps.
return: a list of address ranges \[begin, end\) of gaps

## 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: getInstructionCount
- return type: `int`


## Method: getInstructionLocation
- parameter: `insn`, type: `InsnType`
- return type: `com.pnfsoftware.jeb.util.base.Couple<com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>,java.lang.Integer>`

Description: Locate an instruction.
parameter: insn: 
return: 

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


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


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

Description: Get the map of addresses to instructions that compose this CFG.
return: 

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


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


## Method: getTimedOperationVerifier
- return type: `com.pnfsoftware.jeb.util.concurrent.TimedOperationVerifier`

Description: 
return: 

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

Description: Retrieve the current variable information provider.
return: the provider, null if none was set

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

Description: Determine if this CFG has exit blocks, that is, blocks without out\-edges.
return: 

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

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

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


## Method: indexedBlocks
- return type: `java.lang.Iterable<com.pnfsoftware.jeb.util.base.Couple<java.lang.Integer,com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>>>`

Description: Get an indexed\-block iterator.
return: an iterator providing basic blocks as well as their indices in the CFG

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


## 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 [IDFA#STANDARD_INTEGRATE_INPUTS](IDFA#STANDARD_INTEGRATE_INPUTS).

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

Description: Get a block iterator.
return: an iterator \(not supporting [remove](Iterator#remove())\)

## Method: reconnectEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- parameter: `z`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.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)).

## Method: reconnectEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- parameter: `z`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.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\); if non\-null, this method            can introduce duplicate edges
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: reconnectIrregularEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- parameter: `z`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.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: 
parameter: y: 
parameter: z: 
return: 

## Method: reconnectIrregularEdge
- parameter: `x`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- parameter: `z`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.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\)
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.asm.cfg.BasicBlock<InsnType>`
- parameter: `y`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- parameter: `z`, type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.BasicBlock<InsnType>`
- return type: `int`

Description: 
parameter: x: 
parameter: y: 
parameter: z: 
return: 

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

Description: Remove a block, and update the fixtures. **This method is content\-agnostic.** 

 A CFG should never contain empty blocks or orphan blocks \(no parents\). However, when the CFG is optimized, instructions and edges are removed, and some nodes might end up empty or orphans. This transient, stale state is fine AS LONG AS the client knows what it is doing and removes the blocks as soon as they're done, before passing it down the processing chain. This method removes such blocks and updates the edges of connected and connecting blocks. 

 Caveats: 
 
- 1st caveat: the block's out\-degree is one, OR the block's in\-degree is one or zero. \(Otherwise, stitching up the edges would not be possible.\)
-  
- 2nd caveat: duplicate edges can be introduced. The client should remove them if it doesn't like that.
-  
- 3rd caveat: the fixtures update is instruction\-agnostic. This means that the client is solely responsible regarding the decision to remove a 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: removeUnreachableBlocks
- return type: `int`

Description: Remove all blocks not reachable from the entry\-point.
return: count of removed blocks

## Method: removeUnreachableBlocks
- parameter: `forced`, type: `boolean`
- return type: `int`

Description: Remove all blocks not reachable from the entry\-point. 

 If the CFG is composed of [IResizableInstruction](IResizableInstruction), instruction sizes may be adjusted to avoid the introduction of gaps between blocks.
parameter: forced: if true, unreachable blocks will be removed even if the CFG's flags specify            that unreachable blocks are allowed
return: count of removed blocks

## Method: replaceInstruction
- parameter: `targetAddress`, 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 \(e.g., 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: targetAddress: 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: replaceInstruction
- parameter: `targetInsn`, type: `InsnType`
- parameter: `insn`, type: `InsnType`
- return type: `InsnType`

Description: Replace an instruction by reference. No adjustment is done \(e.g., 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: targetInsn: the target instruction
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 [IDFA#STANDARD_COLLECTION_FLAGS](IDFA#STANDARD_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 [IDFA#STANDARD_INTEGRATE_INPUTS](IDFA#STANDARD_INTEGRATE_INPUTS).
return: the previously set value

## Method: setTimedOperationVerifier
- parameter: `tov`, type: `com.pnfsoftware.jeb.util.concurrent.TimedOperationVerifier`

Description: Set an optional timer verifier that will be checked during long operations, including DFA computations.
parameter: tov: 

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

Description: Set the variable information provider. 

 The provider is used by two components:
 \- The data flow analysis components: the provider is used to determine which variables are 'copies' of other variables, and can selectively block their propagation to avoid cluttering live\-var data and reaching\-var data \(especially imporntant to have clean reaching \-output information\)
 \- The CFG formatter: when rendering a CFG with data chains: variables are rendered using their names instead of their ids
parameter: prv: Optional provider
return: the previous provider

## Method: shallowCopy
- parameter: `copyBlockReferences`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.CFG<InsnType>`

Description: Perform a shallow duplication of a CFG:
 \- Block references are optionally copied
 \- DFA data is not copied
parameter: copyBlockReferences: 
return: a new CFG

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

Description: Merge consecutive blocks that can be safely merged.
return: 

## Method: simplify
- parameter: `mergeOnCalls`, type: `boolean`
- parameter: `mergeOnJumps`, type: `boolean`
- parameter: `mergeNonConsecutive`, type: `boolean`
- return type: `int`

Description: **Usage of this function is not recommended.** 

 Merge the blocks that can be merged, without changing the flow of the graph. **WATCH OUT\! When merging with mergeOnCalls or mergeOnJumps set to true, the branching instructions are not removed from the merged blocks. It is the responsibility of the client to remove unnecessary branching instructions in those cases.** 

 Necessary conditions include: adjacent blocks, first block falls thru the second one \(possibly through two duplicate edges\), no block shall have irregular outputs, and only the first block may have irregular inputs. 

 Data flow analysis: not used; invalidated \(if simplifications were performed\). 

 This method uses [IInstruction#getBreakingFlow(long)](IInstruction#getBreakingFlow(long)) and [IInstruction#getRoutineCall(long)](IInstruction#getRoutineCall(long)) to determine block ends.
parameter: mergeOnCalls: if true, this optimization will merge blocks ending by a call to a            sub\-routine
parameter: mergeOnJumps: if true, this optimization will merge blocks ending by a simple branching            instruction
parameter: mergeNonConsecutive: allow to merge non strictly consecutive blocks. There are some            conditions to respect: the order must be correct, there must NOT exist a block            between two consecutive blocks AND the second block must have no outblock. Be            careful that there may remain a non\-sense jump instruction and it must be            necessary to add a jump to previously fallthrough address \(caller has to manage            it\).
return: number of mergers performed

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


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

Description: Split a block into two blocks.
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`


