com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.IEImm |
A terminal IR representing an immediate value. This IR object is holding a sequence of bits whose
interpretation can be:
- a 2-complement arithmetic integer of any length
- a single-precision 32-bit IEEE-754 floating-point value
- a double-precision 64-bit IEEE-754 floating-point value
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract IEImm |
_add(IEImm val)
Perform an addition.
| ||||||||||
abstract IEImm |
_and(IEImm val)
Perform a binary-and operation.
| ||||||||||
abstract int |
_bitlength()
Retrieve the effective length in bits, i.e.
| ||||||||||
abstract IEImm |
_clearbit(int pos)
Reset a given bit to 0.
| ||||||||||
abstract int |
_cmp(IEImm val)
Perform a signed operand comparison.
| ||||||||||
abstract int |
_cmpU(IEImm val)
Perform an unsigned operand comparison.
| ||||||||||
abstract IEImm |
_div(IEImm val)
Perform a signed division.
| ||||||||||
abstract IEImm |
_divU(IEImm val)
Perform an unsigned division.
| ||||||||||
abstract IEImm |
_fadd(IEImm val)
Add this IEEE-754 float to another float immediate and return the result.
| ||||||||||
abstract Integer |
_fcmp(IEImm val)
Compare this IEEE-754 float with another float immediate and return 0, +1, -1 depending on
the result of the comparison.
| ||||||||||
abstract IEImm |
_fdiv(IEImm val)
Divide this IEEE-754 float by another float immediate and return the result.
| ||||||||||
abstract IEImm |
_fmul(IEImm val)
Multiply this IEEE-754 float to another float immediate and return the result.
| ||||||||||
abstract IEImm |
_fsub(IEImm val)
Subtract the IEEE-754 float parameter from this float immediate and return the result.
| ||||||||||
abstract boolean |
_isPowerOf2()
Determine whether this immediate (treated as an unsigned integer) is a power of 2.
| ||||||||||
abstract Integer |
_log2()
Perform an exact log2 on this immediate treated as an unsigned integer.
| ||||||||||
abstract IEImm |
_mul(IEImm val)
Perform a (truncated) multiplication.
| ||||||||||
abstract IEImm |
_neg()
Perform a negation.
| ||||||||||
abstract IEImm |
_not()
Perform a binary-not operation.
| ||||||||||
abstract IEImm |
_or(IEImm val)
Perform a binary-or operation.
| ||||||||||
abstract IEImm |
_pow(int exponent)
Perform an exponentiation.
| ||||||||||
abstract IEImm |
_rem(IEImm val)
Perform a signed remainder (modulo) operation.
| ||||||||||
abstract IEImm |
_remU(IEImm val)
Perform an unsigned remainder (modulo) operation.
| ||||||||||
abstract IEImm |
_rol(int cnt)
Perform a left-rotate operation.
| ||||||||||
abstract IEImm |
_ror(int cnt)
Perform a right-rotate operation.
| ||||||||||
abstract IEImm |
_sar(int cnt)
Perform an arithmetic right-shift operation (sign bit is maintained).
| ||||||||||
abstract IEImm |
_setbit(int pos)
Set a given bit to 1.
| ||||||||||
abstract IEImm |
_shl(int cnt)
Perform a left-shift operation.
| ||||||||||
abstract IEImm |
_shr(int cnt)
Perform a regular right-shift operation.
| ||||||||||
abstract int |
_signum()
Retrieve the sign number of this immediate: 0 if 0, -1 if negative, +1 if positive.
| ||||||||||
abstract IEImm |
_sub(IEImm val)
Perform a subtraction.
| ||||||||||
abstract boolean |
_testbit(int pos)
Test if a given bit is set.
| ||||||||||
abstract IEImm |
_xor(IEImm val)
Perform a binary-xor operation.
| ||||||||||
abstract boolean | canReadAsAddress() | ||||||||||
abstract boolean | canReadAsDoubleFloat() | ||||||||||
abstract boolean |
canReadAsLong()
Determine if this value can fit on a 64-bit long primitive.
| ||||||||||
abstract boolean | canReadAsSingleFloat() | ||||||||||
abstract boolean |
canReadAsUnsignedLong()
Determine if this value can fit as an unsigned long on a 64-bit long primitive (ie, with the
MSB is set to 0).
| ||||||||||
abstract IEImm |
duplicate()
The resulting copy may not be mutable.
| ||||||||||
abstract IEImm |
duplicateToMutable()
Create a mutable copy of this immediate.
| ||||||||||
abstract IEImm |
duplicateWithType(IWildcardType type)
Create a mutable copy of this immediate and assign it a type.
| ||||||||||
abstract IEImm |
expand(int bits)
Expand (zero-extension) this immediate.
| ||||||||||
abstract ICElement |
getCustomAST()
Retrieve the custom AST element that will be used when generating C code, if one was set.
| ||||||||||
abstract IWildcardType.Group |
getGroup()
Determine the current group for the immediate: integer or float.
| ||||||||||
abstract String | getStringLiteral() | ||||||||||
abstract BigInteger |
getUnsignedValue()
Get this immediate as an unsigned big integer value.
| ||||||||||
abstract BigInteger |
getValue()
Get this immediate as a big integer value (signed).
| ||||||||||
abstract long |
getValueAsAddress()
Get the immediate value as a primitive long, preferably unsigned.
| ||||||||||
abstract double | getValueAsDoubleFloat() | ||||||||||
abstract long |
getValueAsLong()
Get the immediate value as a signed primitive long.
| ||||||||||
abstract float | getValueAsSingleFloat() | ||||||||||
abstract long |
getValueAsUnsignedLong()
Get the immediate value as an unsigned, zero-extended primitive long.
| ||||||||||
abstract boolean |
isMutable()
Determine if this immediate is mutable.
| ||||||||||
abstract boolean |
isOnes()
Determine whether this immediate has all its bits set to 1.
| ||||||||||
abstract boolean | isStringLiteral() | ||||||||||
abstract boolean |
isZero()
Determine whether this immediate has all its bits set to 0.
| ||||||||||
abstract IEImm |
normalize()
Normalize this immediate bvy generating an immediate whose internal representation better
matches the type.
| ||||||||||
abstract boolean |
setCustomAST(ICElement customAST)
Set a custom AST element to be used when generating C code.
| ||||||||||
abstract IEImm |
signExtend(int newBitsize)
Sign extend the current
IEGeneric . | ||||||||||
abstract String |
toHexString()
Format this immediate as an unsigned hexadecimal string.
| ||||||||||
abstract IEImm |
truncate(int bits)
Truncate this immediate or sign-extend it.
| ||||||||||
abstract IEImm |
zeroExtend(int newBitsize)
Zero extend the current
IEGeneric |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.pnfsoftware.jeb.core.units.code.IInstructionOperand
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.IEGeneric
|
Retrieve the effective length in bits, i.e. the minimal number of bits required to store this immediate.
Add this IEEE-754 float to another float immediate and return the result.
Compare this IEEE-754 float with another float immediate and return 0, +1, -1 depending on the result of the comparison. Comparisons are ordered. If any of the operands are unordered, null is returned.
Divide this IEEE-754 float by another float immediate and return the result.
Multiply this IEEE-754 float to another float immediate and return the result.
Subtract the IEEE-754 float parameter from this float immediate and return the result.
Determine whether this immediate (treated as an unsigned integer) is a power of 2.
Perform an exact log2 on this immediate treated as an unsigned integer. If the immediate is not a power of 2, a null value is returned.
Perform an exponentiation.
exponent | must be positive or zero |
---|
Perform an arithmetic right-shift operation (sign bit is maintained). The effective count is
computed modulo-positive getBitsize()
.
Perform a left-shift operation. The effective count is computed modulo-positive
getBitsize()
.
Perform a regular right-shift operation. The effective count is computed modulo-positive
getBitsize()
.
Retrieve the sign number of this immediate: 0 if 0, -1 if negative, +1 if positive.
Test if a given bit is set.
Determine if this value can fit on a 64-bit long primitive.
Determine if this value can fit as an unsigned long on a 64-bit long primitive (ie, with the MSB is set to 0).
The resulting copy may not be mutable. It will be mutable IFF this object is mutable itself.
To ensure that the copy is mutable, use duplicateWithType(IWildcardType)
or
duplicateToMutable()
.
Create a mutable copy of this immediate. Those immediates can be assigned
types
and custom AST elements.
Create a mutable copy of this immediate and assign it a type. Those immediates can be
assigned types
and custom AST elements..
type | the initial type, may be null |
---|
Expand (zero-extension) this immediate. If bits if less than the bitsize of this immediate, this method is the same as truncate. If bits is greater than the bitsize of this immediate, then the resulting value is zero-extended.
Retrieve the custom AST element that will be used when generating C code, if one was set.
Determine the current group for the immediate: integer or float. Do not confuse with
getType()
, although the group can be used to infer an appropriate type.
Get this immediate as an unsigned big integer value.
Get this immediate as a big integer value (signed).
Get the immediate value as a primitive long, preferably unsigned. Will raise if the value does not fit on 64-bits.
Get the immediate value as a signed primitive long. Will raise if the value does not fit in [LONG_MIN, LONG_MAX] range (64 bits).
Get the immediate value as an unsigned, zero-extended primitive long. Will raise if the value does not fit within [0, LONG_MAX] range (63 bits).
getValueAsLong()
is a safer method.
Determine if this immediate is mutable. By default, they are not. Use
duplicateWithType(IWildcardType)
to create a mutable immediate to which a type and
custom AST element can be assigned.
Determine whether this immediate has all its bits set to 1.
Determine whether this immediate has all its bits set to 0.
Note: do not mix this up with a zero-value equality check. That works if the underlying value is to be interpreted as an 2-complement integer, but may not work if the imm is to be understood as an ieee754 float value.
Normalize this immediate bvy generating an immediate whose internal representation better matches the type. If this immediate is not typed, it cannot be normalized. If the immediate is already normalized or cannot be normalized, this method returns null.
Set a custom AST element to be used when generating C code. Reserved for
mutable
elements.
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)
newBitsize | must be superior to getBitsize()
|
---|
Format this immediate as an unsigned hexadecimal string.
Truncate this immediate or sign-extend it. If bits if less than the bitsize of this immediate, it is truncated. If bits is greater than the bitsize of this immediate, then the resulting value is sign-extended.
Zero extend the current IEGeneric
newBitsize | must be superior to getBitsize()
|
---|