public interface

IEGeneric

implements IInstructionOperand
com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.IEGeneric
Known Indirect Subclasses

Summary

Public Methods
abstract boolean accessesMemory()
abstract IEGeneric bit(int pos)
abstract IECond countSuccessiveBits(boolean ones, boolean fromMsb, int bitsize)
Count successive bits in an integer, starting from MSB or LSB.
abstract IEGeneric duplicate()
Clone (deep copy) the expression.
abstract IEImm evaluate(IEState state)
Evaluate the IRE.
abstract long evaluateA(IEState state)
Evaluate the IRE as a 64-bit address;
abstract long evaluateL(IEState state)
Evaluate the IRE as an unsigned long value.
abstract int getBitsize()
Get the size, in bits, of the IR expression.
abstract void getDefinedOrUsedVarsAsDestination(List<IEVar> def, List<IEVar> use)
For non-IEStatement IREs only.
abstract void getExplicitlyUsedVars(List<IEVar> use)
Get a list of variables 'explicitly used' (read) by the instruction.
abstract int getPriority()
Get the base priority level of the expression.
abstract void getSubExpressions(List<IEGeneric> list)
Shallow collection.
abstract void getUsedVars(List<IEVar> use)
Get a list of variables 'used' (read) by the instruction.
abstract IEGeneric leftShift(int shift)
abstract IEGeneric leftShift(int shift, int bitSize)
abstract IEGeneric lsb()
abstract IEGeneric msb()
abstract IEGeneric part(int cnt)
abstract boolean replaceSubExpression(IEGeneric oldExp, IEGeneric newExp)
Shallow replacement, by reference.
abstract int replaceVar(IEVar var, IEGeneric repl)
Deep replace.
abstract IEGeneric rightShift(int shift)
abstract IEGeneric rightShift(int shift, int bitsize)
abstract IEGeneric signExtend(int newBitsize, boolean duplicate)
abstract IEGeneric signExtend(int newBitsize)
Sign extend the current IRE
abstract IEGeneric slice(IERange r)
abstract IEGeneric slice(int begin, int end)
abstract void verify()
Verify the legality of this IR expression.
abstract boolean visitDepthPost(IEVisitor visitor, IEGeneric parent)
Depth-first search, post-order visit of an expression tree or sub-tree.
abstract boolean visitDepthPost(IEVisitor visitor)
abstract boolean visitDepthPre(IEVisitor visitor, IEGeneric parent)
Depth-first search, pre-order visit of an expression tree or sub-tree.
abstract boolean visitDepthPre(IEVisitor visitor)
abstract IEGeneric zeroExtend(int newBitsize)
Zero extend the current IRE
[Expand]
Inherited Methods
From interface com.pnfsoftware.jeb.core.units.code.IInstructionOperand

Public Methods

public abstract boolean accessesMemory ()

Returns
  • true if the expression reads or writes to memory

public abstract IEGeneric bit (int pos)

public abstract IECond countSuccessiveBits (boolean ones, boolean fromMsb, int bitsize)

Count successive bits in an integer, starting from MSB or LSB.

Parameters
ones true if '1's should be counted, false for '0's
fromMsb true if count should start from MSB, false from LSB

public abstract IEGeneric duplicate ()

Clone (deep copy) the expression.

Returns
  • the duplicate expression

public abstract IEImm evaluate (IEState state)

Evaluate the IRE.

Parameters
state IR state (input and output)
Returns
  • the evaluation if the IRE

public abstract long evaluateA (IEState state)

Evaluate the IRE as a 64-bit address;

public abstract long evaluateL (IEState state)

Evaluate the IRE as an unsigned long value. This convenience method will throw if the underlying immediate bit size exceeds 63 bits (unsigned value). TODO: rename to evaluateUL

Returns
  • the evaluation if the IRE, as an unsigned value, if meaningful; the state is also updated

public abstract int getBitsize ()

Get the size, in bits, of the IR expression. It is illegal to query The bitsize of some expressions.

Returns
  • the size in bits

public abstract void getDefinedOrUsedVarsAsDestination (List<IEVar> def, List<IEVar> use)

For non-IEStatement IREs only. Assuming 'this' is a destination value, extract the vars that are used and defined by it.

Parameters
def list of variables that are defined (will be populated)
use list of variables that are used (will be populated)

public abstract void getExplicitlyUsedVars (List<IEVar> use)

Get a list of variables 'explicitly used' (read) by the instruction. This method is inherently deep. The default implementation calls getUsedVars(List). IRE using implicit used vars must override this method.

public abstract int getPriority ()

Get the base priority level of the expression. Higher number correlates to lower priority; 0 means "no priority". (Therefore, the highest priority level is 1.)

public abstract void getSubExpressions (List<IEGeneric> list)

Shallow collection. Appends to `list` (existing elements are not cleared). The current element (this) is not appended, only the descendants are considered.

Parameters
list non-null output list

public abstract void getUsedVars (List<IEVar> use)

Get a list of variables 'used' (read) by the instruction. This method is inherently deep.

Note that some statements are made of "implicitly used" variables, ie, IEVars that are not explicit constituents of the statement expression (eg, some PC-IEAssign or IEUntranslatedInstruction). This method returns those implicit uses.

Parameters
use non-null output list, should not contain duplicates

public abstract IEGeneric leftShift (int shift)

public abstract IEGeneric leftShift (int shift, int bitSize)

public abstract IEGeneric lsb ()

public abstract IEGeneric msb ()

public abstract IEGeneric part (int cnt)

public abstract boolean replaceSubExpression (IEGeneric oldExp, IEGeneric newExp)

Shallow replacement, by reference. Only the first occurrence is replaced.@return

public abstract int replaceVar (IEVar var, IEGeneric repl)

Deep replace. All matching variables are replaced. The implementation is responsible for duplicating the IR expressions, to ensure that the resulting statement or group of statement does not contain duplicate references to mutable objects.

Returns
  • the number of instances replaced

public abstract IEGeneric rightShift (int shift)

public abstract IEGeneric rightShift (int shift, int bitsize)

public abstract IEGeneric signExtend (int newBitsize, boolean duplicate)

public abstract IEGeneric signExtend (int newBitsize)

Sign extend the current IRE

Parameters
newBitsize must be superior to IRE#getBitsize()

public abstract IEGeneric slice (IERange r)

public abstract IEGeneric slice (int begin, int end)

public abstract void verify ()

Verify the legality of this IR expression.

Throws
IllegalIntermediateExpressionException if the IRE is deemed invalid or illegal

public abstract boolean visitDepthPost (IEVisitor visitor, IEGeneric parent)

Depth-first search, post-order visit of an expression tree or sub-tree. The node being visited may be replaced without notifying the visitor.

Parameters
visitor the visitor object
Returns
  • true if the visit was successful

public abstract boolean visitDepthPost (IEVisitor visitor)

public abstract boolean visitDepthPre (IEVisitor visitor, IEGeneric parent)

Depth-first search, pre-order visit of an expression tree or sub-tree. The node being visited may be replaced, but the client code is responsible for EVisitResults#setReplacedNode(IRE) notifying the visitor.

Parameters
visitor the visitor object
Returns
  • true if the visit was successful

public abstract boolean visitDepthPre (IEVisitor visitor)

public abstract IEGeneric zeroExtend (int newBitsize)

Zero extend the current IRE

Parameters
newBitsize must be superior to IRE#getBitsize()