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 TypeMethodDescriptionbooleanDetermine 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 IDExpressionRetrieve the first operand.default IDExpressionRetrieve the second operand.Get the expression's operator.This convenience method can be used to retrieve the operator type.getRight()booleanisCast()Convenience operation to determine whether this is operation is a cast.booleanConvenience operation to determine whether this is operation is a cast to the provided type.booleanConvenience operation to determine whether this is the tertiary conditional expression.booleanisUnary()Convenience operation to determine whether this is a unary expression.voidreverse()Perform in-place reversal of this logical operation, assumingcanReverse()returnedtrue.voidsetCondPredicate(IDExpression pred) voidsetLeft(IDExpression exp) default voidsetOperand1(IDExpression exp) Set the first operand.default voidsetOperand2(IDExpression exp) Set the second operand.voidsetOperator(IJavaOperator operator) Set the expression operator.voidsetOperator(JavaOperatorType operatorType, IJavaOperatorFactory of) Set the expression operator.voidsetRight(IDExpression exp) voidUpgrade temporaryconversionoperators to legalcastoperators.Methods inherited from interface com.pnfsoftware.jeb.core.units.code.android.ir.IDElement
equalsEx, format, toString, toStringMethods 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, visitDepthPreMethods 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 temporaryconversionoperators to legalcastoperators. 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:IDElementDuplicate this element.- Specified by:
duplicatein interfaceIDElement- Specified by:
duplicatein 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.
-