# Class: com.pnfsoftware.jeb.core.units.code.android.ir.DUtil

`dexdec` IR access and manipulation utility methods.

## Static Method: calculateComplexity
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- return type: `int`

Description: Calculate the trivial complexity metric for the provided IR expression. Every IR element has a weight of 1.
parameter: e: an IR expression
return: the complexity score

## Static Method: canHandlerCatchException
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `h`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExceptionHandler`
- parameter: `exceptionSig`, type: `java.lang.String`
- return type: `boolean`

Description: Determine whether an exception handler can catch an exception type.
parameter: ctx: IR method context
parameter: h: exception handler
parameter: exceptionSig: exception type signature
return: true if the handler can catch the exception type

## Static Method: canThrow
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `from`, type: `int`
- return type: `boolean`

Description: Determine whether the trailing instructions of a block can throw.
parameter: b: block
parameter: from: starting instruction index
return: true if the instructions may throw

## Static Method: canThrow
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `from`, type: `int`
- parameter: `to`, type: `int`
- return type: `boolean`

Description: Determine whether a provided range of instructions of a block can throw.
parameter: b: block to examine
parameter: from: starting index
parameter: to: final index \(exclusive\)
return: true if the instructions may throw

## Static Method: checkBlock
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `opcodes`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.DOpcodeType[]`
- return type: `boolean`

Description: Check for instruction matching in the provided block. The block must be fully matched.
parameter: b: block to check
parameter: opcodes: expected instruction opcodes
return: true if the block exactly matches the opcode sequence

## Static Method: checkSequence
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `blkindex`, type: `int`
- parameter: `opcodes`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.DOpcodeType[]`
- return type: `int`

Description: Check for instruction matching in a sequence of blocks. Blocks must be fully contiguous and fully matched.
 This is an extended version of [#checkBlock(BasicBlock, DOpcodeType...)](#checkBlock(BasicBlock, DOpcodeType...)), which performs matching on a single block.
parameter: cfg: CFG to check
parameter: blkindex: start block index
parameter: opcodes: expected instruction opcodes
return: the number of blocks containing the sequence, or 0 on failure

## Static Method: cleanGraph
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- return type: `int`

Description: Clean the graph of an IR method context.
parameter: ctx: IR method context
return: the number of clean\-up operations performed

## Static Method: collectUniqueVarIds
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- return type: `java.util.Set<java.lang.Integer>`

Description: Collect the unique list of variable ids making up this expression, including the expression itself if is an [IDVar](IDVar).
parameter: e: an IR expression
return: a set of variable ids used in the expression

## Static Method: collectVars
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.android.ir.IDVar>`

Description: Collect all the [variables](IDVar) making up this expression, including the expression itself if is a variable. The returned collection may contain duplicates. Example: If the provided expression if `((var1 + var2 + 5) / var1)`, this method will return `[var1, var2, var1]`. Note that the collection is done in post\-order, so ordering is predictable.
parameter: e: an IR expression
return: a list of all vars used in the expression

## Static Method: copyGraph
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `deepCopy`, type: `boolean`
- parameter: `newContext`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- return type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`

Description: Copy an IR\-CFG.
parameter: cfg: a CFG
parameter: deepCopy: if false, the CFG is only structurally duplicated \(that is, the copy is            shallow: the instructions of the new CFG are reused in the new CFG\); if true, the            instructions are [duplicated](IDInstruction#duplicate()) as well\).
parameter: newContext: if performing deep copy, the optional new context to be            [set up for the IR instructions](IDInstruction#setContext(IDMethodContext))
return: the CFG copy \(deep or shallow\)

## Static Method: countVariable
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- parameter: `var`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDVar`
- return type: `int`

Description: Count the number of occurrences of a given variable in the provided IR expression.
parameter: e: an IR expression
parameter: var: target variable
return: number of occurrences

## Static Method: createRegisterVarId
- parameter: `registerBase`, type: `int`
- parameter: `dualSlot`, type: `boolean`
- return type: `int`

Description: Create the primary variable mapping to a register or couple of registers. A primary variable has an id that can be mapped directly to the underlying Dalvik register id\(s\).
parameter: registerBase: the register id of the Dalvik variable, or first register of the pair if            the variable is dual\-slot; must be in \[0, 0xFFFF\] \(at most 0xFFFE for a dual\-slot            variable\)
parameter: dualSlot: true if the variable maps to a pair of Dalvik registers
return: variable id

## Static Method: determineInterval
- parameter: `hdrblk`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- return type: `java.util.Collection<com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>>`

Description: Find the graph interval rooted in the provided header block. 

 An interval is defined as: *Given a header node H, an interval I\(H\) is the maximal, single\-entry subgraph in which H is the only entry node, and in which all closed paths contain H.*
parameter: hdrblk: header block
return: interval nodes \(the first node is the header\)

## Static Method: dump
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `filename`, type: `java.lang.String`

Description: Dump an IR\-CFG to a Graphviz `dot` file in the user's temporary folder.
parameter: cfg: CFG to dump
parameter: filename: output filename base

## Static Method: dump
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `filename`, type: `java.lang.String`
- parameter: `title`, type: `java.lang.String`

Description: Dump an IR\-CFG to a Graphviz `dot` file in the user's temporary folder.
parameter: cfg: CFG
parameter: filename: filename \(the ".dot" extension will be appended if necessary\)
parameter: title: optional title or header string

## Static Method: formatVarId
- parameter: `varid`, type: `int`
- return type: `java.lang.String`

Description: Generate the standard variable name associated with the provided variable id.
parameter: varid: a variable id
return: the variable name; on error, the method throws [IllegalArgumentException](IllegalArgumentException)

## Static Method: formatVarIds
- parameter: `varids`, type: `java.util.Collection<java.lang.Integer>`
- return type: `java.lang.String`

Description: A convenience method to format a collection of variable ids into a comma\-separated string.
parameter: varids: collection of variable ids
return: a string

## Static Method: generateBlockOffsetMap
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- return type: `java.util.SortedMap<java.lang.Integer,java.lang.Integer>`

Description: Generate an offset IR\-to\-native offset conversion map.
parameter: ctx: IR method context
return: a map of \(IR block offset \-\> Dalvik block offset\)

## Static Method: generateNativeAddress
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `elt`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- return type: `java.lang.String`

Description: Generate a native\-address string for an IR expression.
parameter: ctx: IR method context
parameter: elt: optional IR expression
return: native\-address string

## Static Method: generateNativeCoordinates
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `elt`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- return type: `com.pnfsoftware.jeb.core.output.code.coordinates.ICodeCoordinates`

Description: Generate native coordinates for an IR expression.
parameter: ctx: IR method context
parameter: elt: optional IR expression
return: method or instruction coordinates

## Static Method: getBitsize
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- return type: `int`

Description: Determine the physical bit size used to store the provided expression based on its type, in multiple of 32 bits.
parameter: e: expression to examine
return: bit size, in bits

## Static Method: getCAT
- parameter: `insn`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction`
- parameter: `inclAssigDst`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ContextAccessType`

Description: Determine the aggregated context type of an instruction.
parameter: insn: instruction
parameter: inclAssigDst: if true and the instruction is an assignment, the destination is included            when calculated the CAT; else, the right\-side only is considered
return: aggregated CAT

## Static Method: getExceptionSignature
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `h`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExceptionHandler`
- return type: `java.lang.String`

Description: Retrieve the exception type signature caught by a handler.
parameter: ctx: IR method context
parameter: h: exception handler
return: caught exception type signature, or null if it cannot be resolved

## Static Method: getReachableBlocks
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- return type: `java.util.Collection<com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>>`

Description: Get the list of reachable blocks of the provided IR\-CFG. They are the blocks that can be reached, regularly or irregularly, from the entry\-point block \(i.e. the first block, at offset 0\).
parameter: cfg: CFG to examine
return: reachable blocks

## Static Method: hasInvokeInfo
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- return type: `boolean`

Description: Determine whether the IR expression makes invocations \(general invocations, new, new\-array\).
parameter: e: an IR expression
return: true if the expression contains invocation information

## Static Method: hasVariable
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- parameter: `varid`, type: `int`
- return type: `boolean`

Description: Determine whether the provided expression is or contains the provided variable.
parameter: e: an expression
parameter: varid: the searched variable id
return: true if the expression contains the variable

## Static Method: hasVariables
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- return type: `boolean`

Description: Determine whether the provided expression contains [variables](IDVar).
parameter: e: an IR expression
return: true if the expression contains variables

## Static Method: insertHeaderBlock
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `reqInsnCount`, type: `int`
- parameter: `reqInsnSize`, type: `int`

Description: Insert a header block filled with NOP instructions. Essentially, the CFG is shifted downward to accommodate the insertion of a number of lead instructions \(to be executed before the entry point\). 

 This method never fails. The returned CFG and IR context information is updated to maintain consistency.
parameter: ctx: an IR context
parameter: reqInsnCount: number of NOP instructions to be prepended
parameter: reqInsnSize: size set for each individual instruction

## Static Method: isDoubleSlotVarId
- parameter: `varid`, type: `int`
- return type: `boolean`

Description: Determine whether a variable id represents a double\-slot variable.
parameter: varid: variable id
return: true if the id is a double\-slot variable id

## Static Method: isImmNonZero
- parameter: `exp`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- return type: `boolean`

Description: Determine if an expression is an IR immediate not holding the value 0.
parameter: exp: an IR expression
return: true if the provided expression is an immediate not equivalent to the value 0

## Static Method: isImmValue
- parameter: `exp`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- parameter: `value`, type: `long`
- return type: `boolean`

Description: Determine if an expression is an IR immediate holding the provided value. The immediate value is determined according to its type. If the type of the expression is undetermined, a signed type is assumed.
parameter: exp: an IR expression
parameter: value: the value to check against
return: true if the provided expression that evaluated to the provided value

## Static Method: isImmZero
- parameter: `exp`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- return type: `boolean`

Description: Determine if an expression is an IR immediate holding the value 0.
parameter: exp: an IR expression
return: true if the provided expression is an immediate equivalent to the value 0

## Static Method: isLegalVarId
- parameter: `varid`, type: `int`
- return type: `boolean`

Description: Determine whether a variable id is legal.
parameter: varid: variable id
return: true if the id is a legal single\-slot or double\-slot variable id

## Static Method: isProtectedByCatchAll
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `blk`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- return type: `boolean`

Description: Determine whether the provided block is protected by a `catch-all` \(catching Throwable\).
parameter: ctx: IR method context
parameter: blk: block to examine
return: true if the block is protected by a catch\-all handler

## Static Method: isRegisterVarId
- parameter: `varid`, type: `int`
- return type: `boolean`

Description: Determine whether a variable id maps to one or two Dalvik registers.
parameter: varid: variable id
return: true if the id is a register\-backed variable id

## Static Method: isSingleSlotVarId
- parameter: `varid`, type: `int`
- return type: `boolean`

Description: Determine whether a variable id represents a single\-slot variable.
parameter: varid: variable id
return: true if the id is a single\-slot variable id

## Static Method: isUsingCaughtException
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- return type: `boolean`

Description: Determine whether a handler block uses the caught exception value.
parameter: ctx: IR method context
parameter: b: handler block
return: true if the caught exception is used

## Static Method: isVirtualVarId
- parameter: `varid`, type: `int`
- return type: `boolean`

Description: Determine whether a variable id is virtual.
parameter: varid: variable id
return: true if the id is a virtual variable id

## Static Method: mayBeFinal
- parameter: `f`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDField`
- parameter: `dex`, type: `com.pnfsoftware.jeb.core.units.code.android.IDexUnit`
- return type: `boolean`

Description: Determine whether the provided field is or appears to be `final`.
parameter: f: field expression
parameter: dex: Dex unit used to resolve field metadata
return: true if the field may be final

## Static Method: mergeBlocks
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `firstBlock`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- return type: `boolean`

Description: Merge two blocks.
parameter: ctx: IR context
parameter: firstBlock: the first block, to be merged with the subsequent \(fall\-through\) block
return: success indicator

## Static Method: modifyInstructionSize
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `targetInstruction`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction`
- parameter: `minWantedSize`, type: `int`
- return type: `boolean`

Description: Modify the size of an instruction within a CFG. No CFG block is inserted or deleted. Only instructions' sizes and offsets are updated. Note that the CFG is modified, but the CFG reference within the context is not changed \(i.e. no new CFG is created\).
parameter: ctx: IR context
parameter: targetInstruction: the target instruction
parameter: minWantedSize: the minimal wanted size
return: true if the instruction was modified, false if no modification was required

## Static Method: modifyInstructionSizes
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `modifier`, type: `java.util.function.Function<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction,java.lang.Integer>`
- return type: `int`

Description: Update the instruction sizes of a CFG. This method is a general version of `normalizeGraph()`. No CFG block is inserted or deleted. Only instructions' sizes and offsets are updated. Note that the CFG is modified, but the CFG reference within the context is not changed \(i.e. no new CFG is created\).
parameter: ctx: IR context
parameter: modifier: instruction size provider; the function may return null to indicate that the            instruction size should not change
return: the number of modifications

## Static Method: nextInstruction
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `i`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction`

Description: Determine the meaningful next instruction in the execution flow, assuming no exception was raised. Jump targets are followed, no\-operations are skipped.
parameter: cfg: current CFG
parameter: b: current block
parameter: i: index of the current instruction in the block
return: the next instruction, or null if it cannot be determined accurately

## Static Method: normalizeGraph
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- return type: `int`

Description: Normalize the IR by resetting all instructions to the unit size \(1\). Exception data is updated as well. The modification are done in\-place: the CFG and other objects references remain valid.
parameter: ctx: IR context
return: the number of modifications performed; if nothing has changed, the return value is 0

## Static Method: normalizeGraph
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `wantedInstructionSize`, type: `int`
- return type: `int`

Description: Normalize the IR by resetting all instructions to the required size. Exception data is updated as well. The modification are done in\-place: the CFG and other objects references remain valid.
parameter: ctx: IR context
parameter: wantedInstructionSize: required instruction size, must be 1 or above
return: the number of modifications performed; if nothing has changed, the return value is 0

## Static Method: parseVarIdFromStandardName
- parameter: `varname`, type: `java.lang.String`
- parameter: `softFail`, type: `boolean`
- return type: `int`

Description: Parse a standard variable name \(as generated by [#formatVarId(int)](#formatVarId(int))\) and retrieve the associated variable id.
parameter: varname: a variable name
parameter: softFail: if true, return \-1 on error; else, the method will throw            [IllegalArgumentException](IllegalArgumentException) on error
return: the id

## Static Method: removeGaps
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- return type: `int`

Description: Remove all gaps from the provided IR\-CFG. 

 Gaps are illegal in an IR\-CFG. They are tolerated during an optimization phase; however, an optimizer, or any code modifying the IR, must provide a legal IR to subsequent components.
parameter: cfg: CFG to update
return: the number of gaps that were removed

## Static Method: removeInstruction
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `idx`, type: `int`
- return type: `boolean`

Description: Remove an instruction in a block. Throws on error \(watch out: the boolean return value does not indicate failure\).
parameter: b: basic block
parameter: idx: index of the instruction to remove in this block
return: true if the instruction was truly removed, false if it was removed and replaced by an         unconditional jump to avoid creating an empty block

## Static Method: removeUnreachableBlocks
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- return type: `int`

Description: Remove unreachable blocks from an IR\-CFG. They are blocks that cannot be reached, regularly or irregularly, from the entry\-point block \(i.e. the first block, at offset 0\). 

 Unreachable blocks are illegal in an IR\-CFG. They are tolerated during an optimization phase; however, an optimizer, or any code modifying the IR, must provide a legal IR to subsequent components.
parameter: ctx: IR method context
return: the number of removed blocks

## Static Method: removeUnreachableBlocks
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `ex`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDTryData`
- return type: `int`

Description: Remove unreachable blocks from an IR\-CFG. They are blocks that cannot be reached, regularly or irregularly, from the entry\-point block \(i.e. the first block, at offset 0\). 

 Unreachable blocks are illegal in an IR\-CFG. They are tolerated during an optimization phase; however, an optimizer, or any code modifying the IR, must provide a legal IR to subsequent components.
parameter: cfg: CFG to update
parameter: ex: exception data to update
return: the number of removed blocks

## Static Method: removeUnreachableTrampoline
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `b`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- return type: `boolean`

Description: Remove an unreachable trampoline block \(ending on a JCOND or JUMP\).
parameter: cfg: CFG to update
parameter: b: the block must be an unreachable \(no input\) trampoline \(single\-instruction            jump/jcc\); if the block is the first block in the CFG, the method will fail
return: true if the block was removed

## Static Method: replaceInExpression
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- parameter: `target`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- parameter: `repl`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- return type: `boolean`

Description: Replace an IR expression located inside another IR. This method is a deep version of [IDExpression#replaceSubExpression(IDExpression, IDExpression)](IDExpression#replaceSubExpression(IDExpression, IDExpression)). Comparison is done by identity.
parameter: e: parent IR
parameter: target: the target to be replaced; should not be the same as \`e\`
parameter: repl: the replacement IR
return: true if the target was successfully replaced

## Static Method: simplifyJCondsAndSwitches
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- return type: `int`

Description: Simplify [DOpcodeType#IR_JCOND](DOpcodeType#IR_JCOND) and [DOpcodeType#IR_SWITCH](DOpcodeType#IR_SWITCH) IR instructions:
 \- JCOND: the target branch must not point to the fallthrough instruction; if it is, the JCOND must be replaced by a JUMP \(while taking care of potential side\-effects introduced by the evaluation of the JCOND predicate\)
 \- SWITCH: the case targets must not point to the fallthrough instruction; if any does, the case entry must be removed \(and will be taken care by the switch's `default` entry\) 

 Illegal JCOND/SWITCH are tolerated during an optimization phase; however, an optimizer, or any code modifying the IR, must provide a legal IR to subsequent components.
parameter: ctx: IR method context
return: the number of simplified instructions

## Static Method: splitBlock
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `blk`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`

Description: Split a block of the context's CFG into two blocks. The newly\-created block will be set up to have the same irregular outputs as the original block. The context's exception information data will be updated accordingly.
parameter: ctx: IR context
parameter: blk: 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

## Static Method: unprotectBlock
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `exdata`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDTryData`
- parameter: `blkAddress`, type: `int`
- return type: `boolean`

Description: Unprotect a basic block. The CFG is adjusted and cleaned afterward.
parameter: cfg: CFG to update
parameter: exdata: exception data to update
parameter: blkAddress: block address
return: true if the block was protected and is now unprotected; false if the block was not         protected

## Static Method: unroll
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `pivotVar`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDVar`
- parameter: `addrStart`, type: `long`
- parameter: `addrEnd`, type: `long`
- parameter: `maxProcessedInsnCount`, type: `int`
- parameter: `maxUnrolledInsnCount`, type: `int`
- parameter: `maxLoopIterCnt`, type: `int`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`

Description: Attempt to unroll some code whose pivot is a single [variable](IDVar). The generated code will not contain branching instructions JUMP, JCOND, SWITCH, RETURN, THROW, etc.\).
parameter: ctx: IR method context \(which references the CFG to operate on\)
parameter: pivotVar: pivot variable
parameter: addrStart: start address \(inclusive\) \- generally, the instruction at that address            initializes the pivot variable, although it is not a requirement
parameter: addrEnd: end address \(exclusive\), will stop the unrolling process
parameter: maxProcessedInsnCount: maximum amount of instructions to process until the end is            reached
parameter: maxUnrolledInsnCount: maximum amount of unrolled instructions that may be generated
parameter: maxLoopIterCnt: maximum count of iterations to be unrolled \(note: keep in mind for            values greater than 1, the resulting IR is likely to be larger than the original            IR\)
return: null on error or failure, else the list of unrolled instructions \(the list may         contain duplicates, client code needs to use [IDInstruction#duplicate()](IDInstruction#duplicate()) to         create unique instructions\)

## Static Method: updateTargets
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `oldToNewOffsets`, type: `java.util.Map<java.lang.Integer,java.lang.Integer>`
- return type: `int`

Description: Update branch targets according to an offset map.
parameter: ctx: IR context
parameter: oldToNewOffsets: a mapping of the old offsets to the corresponding new offsets
return: the number of modifications

## Static Method: usesReferences
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- return type: `boolean`

Description: Determine whether the IR expression uses references, defined as any of: accessing fields, accessing array elements, creating arrays.
parameter: e: an IR expression
return: true if the expression uses references

## Static Method: verifyDataFlow
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`

Description: Perform data flow verifications on the graph. Warning: on large graphs, this verification can be very costly. Currently implemented:
 \- verify that live variables at a block entry match the reached variables at the exits points of all input blocks
parameter: cfg: CFG
throws: if a data flow inconsistency is detected

## Static Method: verifyGraph
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`

Description: Verify an IR\-CFG from a method context. On failure, the CFG will be dumped to "failed.dot"
parameter: ctx: IR context, from which the CFG and optional exception\-info object will be pulled
throws: \(or derived, such as [IllegalArgumentException](IllegalArgumentException) or             [IllegalStateException](IllegalStateException)\) if the verification failed

## Static Method: verifyGraph
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `info`, type: `java.lang.String`

Description: Verify an IR\-CFG from a method context. On failure, the CFG will be dumped to "failed.dot"
parameter: ctx: IR context, from which the CFG and optional exception\-info object will be pulled
parameter: info: optional string added to the generated DOT file's header containing the CFG \(if            verification failed\)
throws: \(or derived, such as [IllegalArgumentException](IllegalArgumentException) or             [IllegalStateException](IllegalStateException)\) if the verification failed

## Static Method: verifyGraph
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `dumpFilename`, type: `java.lang.String`
- parameter: `info`, type: `java.lang.String`

Description: Verify an IR\-CFG.
parameter: ctx: context containing the CFG
parameter: dumpFilename: optional path to filename where the CFG will be dumped if the            verification filed
parameter: info: optional string added to the generated DOT file's header containing the CFG \(if            verification failed\)
throws: \(or derived, such as [IllegalArgumentException](IllegalArgumentException) or             [IllegalStateException](IllegalStateException)\) if the verification failed

## Static Method: verifyGraph
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- parameter: `exdata`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDTryData`
- parameter: `dumpFilename`, type: `java.lang.String`
- parameter: `info`, type: `java.lang.String`

Description: Verify an IR\-CFG.
parameter: ctx: IR method context
parameter: cfg: CFG
parameter: exdata: optional exception\-info object
parameter: dumpFilename: optional path to filename where the CFG will be dumped if the            verification filed
parameter: info: optional string added to the generated DOT file's header containing the CFG \(if            verification failed\)
throws: \(or derived, such as [IllegalArgumentException](IllegalArgumentException) or             [IllegalStateException](IllegalStateException)\) if the verification failed

## Static Method: verifyUnicity
- parameter: `cfg`, type: `com.pnfsoftware.jeb.core.units.code.android.controlflow.CFG<com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction>`
- return type: `int`

Description: Verify IR unicity within a full graph.
parameter: cfg: CFG to verify
return: \(informative\) count of collected expressions
throws: if a duplicate expression is found

## Static Method: verifyUnicity
- parameter: `exp`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- return type: `int`

Description: Verify IR unicity within an expression.
parameter: exp: an IR expression
return: \(informative\) count of collected expressions
throws: if a duplicate expression is found

