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

Facility for CFG graph nodes reordering. Trampoline blocks will be created to ensure the original execution flow is maintained.

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

Description: Create a CFG reorganizer.
parameter: cfg: CFG to reorganize

## Protected Method: buildCFG
- parameter: `statements`, type: `java.util.List<InsnType>`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.CFG<InsnType>`

Description: Build a CFG from reordered statements.
parameter: statements: instruction list
return: CFG

## Protected Method: canFallthrough
- parameter: `insn`, type: `InsnType`
- return type: `boolean`

Description: Determine if the provided instruction is a flow breaker that falls\-through \(or may, if it's a conditional branch\) into the first instruction of the next block.
parameter: insn: instruction
return: true if the instruction may fall through

## Protected Method: createNop
- parameter: `insnSize`, type: `int`
- return type: `InsnType`

Description: Create a NOP instruction.
parameter: insnSize: instruction size
return: NOP instruction

## Protected Method: createTrampoline
- parameter: `tempTarget`, type: `long`
- return type: `InsnType`

Description: Create a trampoline instruction whose size must be 1.
parameter: tempTarget: temporary target address
return: trampoline instruction

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

Description: Retrieve a map holding the old offsets to their corresponding new offsets, in the reorganized CFG.
return: conversion map from old offsets to new offsets

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

Description: Retrieve a CFG reorganized by [#reorder(int[])](#reorder(int[])).
return: reorganized CFG, or null

## Protected Method: hasTargets
- parameter: `insn`, type: `InsnType`
- return type: `boolean`

Description: Determine whether the instruction has targets that may be updated.
parameter: insn: instruction
return: true if the instruction has updateable targets

## Method: reorder
- parameter: `newOrder`, type: `int[]`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.cfg.CFG<InsnType>`

Description: Reorder basic blocks according to the provided order.
parameter: newOrder: an array of 0\-based indices from 0 to n\-1; providing \[0, 1, ..., n\-1\] does            nothing
return: a reordered CFG; null if the provided order was the original order

## Protected Method: updateTargets
- parameter: `insn`, type: `InsnType`
- parameter: `map`, type: `java.util.Map<java.lang.Long,java.lang.Long>`

Description: Update instruction targets.
parameter: insn: instruction to update
parameter: map: old\-to\-new address map

## Protected Method: updateTrampolineTarget
- parameter: `insn`, type: `InsnType`
- parameter: `target`, type: `long`

Description: Update a trampoline instruction target.
parameter: insn: must be a trampoline instruction
parameter: target: new target address

