Interface IDOperation
- All Superinterfaces:
IDElement
,IDExpression
,IInstructionOperand
dexdec
IR operation expression. Operations include: arithmetic and bitwise operations,
logical expressions, the ternary (conditional) expression, cast operations, etc.
An operation is made of one operator
and 1, 2, or 3 operands:
- 1 operand for unary expressions, e.g a cast
- 2 operands for duary expressions, e.g. an addition
- 3 operands for ternary expressions, e.g. a conditional
Examples:
c = a + 1; ^^^^^ e = x ? c: d; ^^^^^^^^ s = (short)x; ^^^^^^^^ list = (List)obj; ^^^^^^^^^
-
Field Summary
Fields inherited from interface com.pnfsoftware.jeb.core.units.code.android.ir.IDElement
DEFAULT_COMPARE_WITH_FULL_EQUALITY
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Determine whether this operation, if it is a logical operation, can be reversed in-place (no new IR element would created).Duplicate this element.If this IR is a conditional operation, retrieve the conditional's true expression.If this IR is a conditional operation, retrieve the conditional's predicate.If this IR is a conditional operation, retrieve the conditional's true expression.getLeft()
default IDExpression
Retrieve the first operand.default IDExpression
Retrieve the second operand.Get the expression's operator.This convenience method can be used to retrieve the operator type.getRight()
boolean
isCast()
Convenience operation to determine whether this is operation is a cast.boolean
Convenience operation to determine whether this is operation is a cast to the provided type.boolean
Convenience operation to determine whether this is the tertiary conditional expression.boolean
isUnary()
Convenience operation to determine whether this is a unary expression.void
reverse()
Perform in-place reversal of this logical operation, assumingcanReverse()
returnedtrue
.void
setCondPredicate
(IDExpression pred) void
setLeft
(IDExpression exp) default void
setOperand1
(IDExpression exp) Set the first operand.default void
setOperand2
(IDExpression exp) Set the second operand.void
setOperator
(IJavaOperator operator) Set the expression operator.void
setOperator
(JavaOperatorType operatorType, IJavaOperatorFactory of) Set the expression operator.void
setRight
(IDExpression exp) void
Upgrade temporaryconversion
operators to legalcast
operators.Methods inherited from interface com.pnfsoftware.jeb.core.units.code.android.ir.IDElement
equalsEx, format, toString, toString
Methods inherited from interface com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression
asArrayElt, asCallInfo, asImm, asInstanceField, asInstruction, asNewArrayInfo, asNewInfo, asOperation, asReferenceType, asStaticField, asVar, canThrow, checkType, collectAllPhysicalMethodIndices, collectAllPhysicalOffsets, collectSubExpressions, collectVarIds, copy, countVariable, evaluate, evaluate, evaluate, find, findByType, findByType, findParent, findParent, generateAST, getCustomCanThrow, getData, getOrigin, getPhysicalMethodIndex, getPhysicalOffset, getSubExpressions, getType, getVarIds, hasSideEffects, isArrayElt, isCallInfo, isCallInfo, isCastOperation, isCastOperation, isConstantImm, isConstantImm, isImm, isInstanceField, isInstruction, isNewArrayInfo, isNewInfo, isOperation, isOperation, isOperation, isOperation, isOperation, isOperation, isOperation, isReferenceType, isStaticField, isStringImm, isVar, isVar, removeData, replaceSubExpression, replaceVariable, setCustomCanThrow, setData, setOrigin, setPhysicalMethodIndex, setPhysicalOffset, setType, setType, setType, spawn, transferMetadataFrom, updateAllPhysicalMethodIndices, updateAllPhysicalOffsets, updateTypes, visitDepthPost, visitDepthPost, visitDepthPost, visitDepthPre, visitDepthPre, visitDepthPre
Methods inherited from interface com.pnfsoftware.jeb.core.units.code.IInstructionOperand
format
-
Method Details
-
getOperator
IJavaOperator getOperator()Get the expression's operator.- Returns:
- the operator object
-
getOperatorType
JavaOperatorType getOperatorType()This convenience method can be used to retrieve the operator type. It is the same asgetOperator().getOperatorType()
.- Returns:
- an operator type enumerated constant
-
setOperator
Set the expression operator.- Parameters:
operator
-
-
setOperator
Set the expression operator. Alternate method.- Parameters:
operatorType
-of
-
-
getOperand1
Retrieve the first operand. Same asgetLeft()
.- Returns:
- null for unary expressions
-
setOperand1
Set the first operand. Same assetLeft(IDExpression)
.- Parameters:
exp
-
-
getOperand2
Retrieve the second operand. Same asgetRight()
.- Returns:
- never null
-
setOperand2
Set the second operand. Same assetRight(IDExpression)
.- Parameters:
exp
-
-
getLeft
IDExpression getLeft()- Returns:
- null for unary expressions
-
setLeft
- Parameters:
exp
-
-
getRight
IDExpression getRight()- Returns:
- never null
-
setRight
- Parameters:
exp
-
-
getCondPredicate
IDExpression getCondPredicate()If this IR is a conditional operation, retrieve the conditional's predicate.- Returns:
- null for non conditional expressions
-
setCondPredicate
-
getCondTrueExpression
IDExpression getCondTrueExpression()If this IR is a conditional operation, retrieve the conditional's true expression. The same asgetLeft()
.- Returns:
-
getCondFalseExpression
IDExpression getCondFalseExpression()If this IR is a conditional operation, retrieve the conditional's true expression. The same asgetRight()
.- Returns:
-
isUnary
boolean isUnary()Convenience operation to determine whether this is a unary expression.- Returns:
-
isConditional
boolean isConditional()Convenience operation to determine whether this is the tertiary conditional expression.- Returns:
-
isCast
boolean isCast()Convenience operation to determine whether this is operation is a cast.- Returns:
- true if this operation is a cast operation
-
isCast
Convenience operation to determine whether this is operation is a cast to the provided type.- Parameters:
wantedType
- checked cast type- Returns:
- true if this operation is a cast to
wantedType
-
updateConversionOperators
Upgrade temporaryconversion
operators to legalcast
operators. Ths method should be called once only, on a low-level IR. It is reserved for internal use.- Parameters:
ti
- optional type information object, used to record type updates and conflictsgctx
- global IR context (mandatory)
-
duplicate
IDOperation duplicate()Description copied from interface:IDElement
Duplicate this element.- Specified by:
duplicate
in interfaceIDElement
- Specified by:
duplicate
in interfaceIDExpression
- Returns:
- a deep copy of this element; the type of the duplicated element should be the same as this element's type
-
canReverse
boolean canReverse()Determine whether this operation, if it is a logical operation, can be reversed in-place (no new IR element would created).- Returns:
-
reverse
void reverse()Perform in-place reversal of this logical operation, assumingcanReverse()
returnedtrue
. This method throws on failure.
-