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)
Retrieve a one bit value at the pos position
abstract IEGeneric copyTypeFrom(IEGeneric src)
Copy the type of a source IR element, if any, to this element.
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 boolean equalsEx(Object obj, boolean includeType)
Same as #equals(Object) with the possibility to check type or not.
abstract IEImm evaluate(IEState state)
Evaluate the IRE.
abstract long evaluateAddress(IEState state)
Evaluate the IRE as a 64-bit address;@return
abstract long evaluateUnsignedLong(IEState state)
Evaluate the IRE as an unsigned long value.
abstract int getBitsize()
Get the size, in bits, of the IR expression.
abstract void getDefinedOrUsedAsDestination(IdRanges def, IdRanges use)
For non-statements only.
abstract void getExplicitlyUsed(IdRanges use)
Get a list of vbits '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 getUsed(IdRanges use)
Get a list of vbits 'used' (read) by the instruction.
abstract IEGeneric leftShift(int shift)
left shift of an expression
abstract IEGeneric leftShift(int shift, int bitSize)
left shift of an expression, with an optional slice(int, int)
abstract IEGeneric lsb()
Return the least significant bit (lsb) of an expression.
abstract IEGeneric msb()
Return the most significant bit (msb) of an expression.
abstract IEGeneric part(int cnt)
Equivalent to slice(0, 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)
right shift of an expression
abstract IEGeneric rightShift(int shift, int bitsize)
right shift of an expression, with an optional slice(int, int)
abstract IEGeneric signExtend(int newBitsize)
Sign extend the current IEGeneric.
abstract IEGeneric slice(IERange r)
abstract IEGeneric slice(int begin, int end)
Slice (remove begin AND/OR end) of an IEGeneric.
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, IEGeneric parent, EVisitResults results)
Depth-first search, post-order visit of an expression tree or sub-tree.
abstract boolean visitDepthPost(IEVisitor visitor)
Depth-first search, post-order visit of an expression tree or sub-tree.
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)
Depth-first search, pre-order visit of an expression tree or sub-tree.
abstract boolean visitDepthPre(IEVisitor visitor, IEGeneric parent, EVisitResults results)
Depth-first search, pre-order visit of an expression tree or sub-tree.
abstract IEGeneric zeroExtend(int newBitsize)
Zero extend the current IEGeneric
[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)

Retrieve a one bit value at the pos position

Parameters
pos bit position to be retrieved
Returns
  • IEGeneric of size 1 with bit at position pos

public abstract IEGeneric copyTypeFrom (IEGeneric src)

Copy the type of a source IR element, if any, to this element.

Parameters
src source element
Returns
  • this element (= destination element)

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 boolean equalsEx (Object obj, boolean includeType)

Same as #equals(Object) with the possibility to check type or not.

Parameters
obj object to compare
includeType true for type comparison (same as #equals(Object)), false if ignoring type

public abstract IEImm evaluate (IEState state)

Evaluate the IRE.

Parameters
state IR state (input and output)
Returns
  • the evaluation if the IRE
Throws
Exception force client code to wrap calls for safe execution

public abstract long evaluateAddress (IEState state)

Evaluate the IRE as a 64-bit address;@return

Throws
Exception force client code to wrap calls for safe execution

public abstract long evaluateUnsignedLong (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).

Returns
  • the evaluation if the IRE, as an unsigned value, if meaningful; the state is also updated
Throws
Exception force client code to wrap calls for safe execution

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 getDefinedOrUsedAsDestination (IdRanges def, IdRanges use)

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

public abstract void getExplicitlyUsed (IdRanges use)

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

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 getUsed (IdRanges use)

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

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

public abstract IEGeneric leftShift (int shift)

left shift of an expression

Parameters
shift left shift value
Returns

public abstract IEGeneric leftShift (int shift, int bitSize)

left shift of an expression, with an optional slice(int, int)

Parameters
shift left shift value
bitSize bitsize of the final IEGeneric. Note that the condition (bitSize - shift < currentBitSize) must be respected.
Returns

public abstract IEGeneric lsb ()

Return the least significant bit (lsb) of an expression. No duplicate is done, it is up to caller to duplicate current IEGeneric if needed.

Returns
  • the least significant bit

public abstract IEGeneric msb ()

Return the most significant bit (msb) of an expression. No duplicate is done, it is up to caller to duplicate current IEGeneric if needed.

Returns
  • the most significant bit

public abstract IEGeneric part (int cnt)

Equivalent to slice(0, cnt)

Parameters
cnt bitsize. Note that the condition (cnt < currentBitSize) must be respected.

public abstract boolean replaceSubExpression (IEGeneric oldExp, IEGeneric newExp)

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

Be careful when replacing immediates or variables. Unexpected behaviors may happen if the expression contains multiple instances of the same imm or var.@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)

right shift of an expression

Parameters
shift right shift value
Returns

public abstract IEGeneric rightShift (int shift, int bitsize)

right shift of an expression, with an optional slice(int, int)

Parameters
shift right shift value
Returns

public abstract IEGeneric signExtend (int newBitsize)

Sign extend the current IEGeneric. This method will create a valid IEGeneric (meaning IEGeneric will not have duplicates id - in particular, in the form C(x, x.msb()?ones():zeros()) where x will be present in base value and msb predicate)

Parameters
newBitsize must be superior to getBitsize()

public abstract IEGeneric slice (IERange r)

public abstract IEGeneric slice (int begin, int end)

Slice (remove begin AND/OR end) of an IEGeneric.

Parameters
begin new beginning bit position. Note that the conditions (begin > 0 AND begin < end) must be respected.
end new end bit position. Note that the conditions (end < currentBitSize AND begin < end) must be respected.
Returns

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.

public abstract boolean visitDepthPost (IEVisitor visitor, IEGeneric parent, EVisitResults results)

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)

Depth-first search, post-order visit of an expression tree or sub-tree. The node being visited may be replaced without notifying the 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(IEGeneric) notifying the visitor.

public abstract boolean visitDepthPre (IEVisitor visitor)

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.

public abstract boolean visitDepthPre (IEVisitor visitor, IEGeneric parent, EVisitResults results)

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 IEGeneric zeroExtend (int newBitsize)

Zero extend the current IEGeneric

Parameters
newBitsize must be superior to getBitsize()