# Interface: com.pnfsoftware.jeb.core.units.code.IInstruction

A generic interface to represent machine\-code or bytecode instructions. Note that this interface does not specify an address or offset for the instruction.

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

Description: Determine if the instruction can throw an exception.
return: true if the exception can raise

## Method: collectIndirectCallReferences
- parameter: `instructionAddress`, type: `long`
- return type: `com.pnfsoftware.jeb.core.units.code.IFlowInformation`

Description: Collect the list of dereferenced addresses computed by a call\-to\-sub instruction. This method should not be confused with [#getRoutineCall(long)](#getRoutineCall(long)).
parameter: instructionAddress: the address of the current instruction
return: [IFlowInformation#isBroken()](IFlowInformation#isBroken()) is true if the instruction indirectly calls into         a sub\-routine, false otherwise \(**in particular for direct routine calls**\); if         true, the [IFlowInformation#getTargets()](IFlowInformation#getTargets()) may be filled with the dereferenced         addresses, else its contents is irrelevant

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

Description: Format the instruction for printing
parameter: context: optional context, used to provide a better representation of the instruction            \(for instance, resolving strings or method names.\) The implementor should do its            best to return a decent result even if context is null.
return: formatted instruction

## Method: getACS
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.ACS`

Description: Get the optional abstract conversion stub.
return: abstract conversion stub, or null

## Method: getBreakingFlow
- parameter: `instructionAddress`, type: `long`
- return type: `com.pnfsoftware.jeb.core.units.code.IFlowInformation`

Description: Determine if an instruction breaks the flow of execution. 

 Examples: jump instructions, conditional jumps, return\-to\-caller instructions, etc. Sub\-routine calls should not be regarded as flow\-breakers by this method. Refer to [getRoutineCall](#getRoutineCall(long)).
parameter: instructionAddress: the address of the current instruction
return: [IFlowInformation#isBroken()](IFlowInformation#isBroken()) is true if the instruction breaks the current         flow of execution \(sub\-routine call instructions are excluded\) , false otherwise; if         true, [IFlowInformation#getTargets()](IFlowInformation#getTargets()) may be filled with potential addresses,         and the first entry should be the fall\-through instruction, if there is any

## Method: getCode
- return type: `byte[]`

Description: Get the binary code that makes up this instruction.
return: an array of bytes, or null if the instruction is abstract

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

Description: Get the number of operands.
return: operand count

## Method: getDefUse
- parameter: `def`, type: `java.util.List<java.lang.Integer>`
- parameter: `use`, type: `java.util.List<java.lang.Integer>`
- parameter: `context`, type: `java.lang.Object`

Description: Determine the variables defined and used by the instruction.
parameter: def: output, the list of variables defined by the instruction.
parameter: use: output, the list of variables used by the instruction
parameter: context: optional context \(implementation specific\)

## Method: getDefUse
- parameter: `def`, type: `java.util.List<java.lang.Integer>`
- parameter: `use`, type: `java.util.List<java.lang.Integer>`

Description: Determine the variables defined and used by the instruction.
parameter: def: output, the list of variables defined by the instruction.
parameter: use: output, the list of variables used by the instruction

## Method: getDefUseInfo
- parameter: `instructionAddress`, type: `long`
- parameter: `flags`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.DefUseInfo`

Description: Determine the variables defined and used by the instruction. This method is an extended version of [#getDefUse(List, List, Object)](#getDefUse(List, List, Object)).
parameter: instructionAddress: address of the instruction
parameter: flags: see `DefUseInfo.XXX` static final flags
return: def\-use information
throws: if this operation is not implemented

## Method: getInstructionFlags
- return type: `java.util.Collection<com.pnfsoftware.jeb.core.units.code.InstructionFlags>`

Description: Get the instruction flags.
return: instruction flags, never null

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

Description: The instruction mnemonic.
return: instruction mnemonic

## Method: getOperand
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.IInstructionOperand`

Description: Get an operand by index.
parameter: index: operand index
return: operand

## Method: getOperands
- return type: `com.pnfsoftware.jeb.core.units.code.IInstructionOperand[]`

Description: Get the list of operands for this instruction.
return: a list \(possibly empty\) of operands, or null if operands are not applicable to the         instruction set

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

Description: Get the instruction's optional prefix\(es\).
return: the prefix \(or prefix string list\), null if none

## Method: getPrimaryBranchAddress
- parameter: `instructionAddress`, type: `long`
- return type: `long`

Description: Convenience method used to retrieve the primary target of this branching instruction. If the instruction is not branching, or if the target cannot be determined, \-1 is returned. If the instruction has multiple branches, only one is returned.
parameter: instructionAddress: the address of the current instruction
return: the target address, or \-1 on error

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

Description: Get the mode the processor was in when it parsed and created this instruction. Refer to [IProcessor](IProcessor) `MODE_xxx`.
return: the mode, 0 for none/default

## Method: getRoutineCall
- parameter: `instructionAddress`, type: `long`
- return type: `com.pnfsoftware.jeb.core.units.code.IFlowInformation`

Description: Determine if an instruction branches to \(or calls into\) a sub\-routine. 

 Under normal circumstances, those instructions save the return address \(e.g., on a stack or in a register\). Therefore, the fall\-through address is implied and should not be returned by [IFlowInformation#getTargets()](IFlowInformation#getTargets()). The list of targets should contain the branch address \- or addresses, for example if the processor branching instruction allows branch selection.
parameter: instructionAddress: the address of the current instruction
return: [IFlowInformation#isBroken()](IFlowInformation#isBroken()) is true if the instruction calls into a         sub\-routine, false otherwise; if true, [IFlowInformation#getTargets()](IFlowInformation#getTargets()) may be         filled, else its contents is irrelevant

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

Description: Get the instruction size in bytes.
return: the instruction size

