Interface IDOperation

All Superinterfaces:
IDElement, IDExpression, IInstructionOperand

public interface IDOperation extends IDExpression
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;
        ^^^^^^^^^
 
  • 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 as getOperator().getOperatorType().
      Returns:
      an operator type enumerated constant
    • setOperator

      void setOperator(IJavaOperator operator)
      Set the expression operator.
      Parameters:
      operator -
    • setOperator

      void setOperator(JavaOperatorType operatorType, IJavaOperatorFactory of)
      Set the expression operator. Alternate method.
      Parameters:
      operatorType -
      of -
    • getOperand1

      default IDExpression getOperand1()
      Retrieve the first operand. Same as getLeft().
      Returns:
      null for unary expressions
    • setOperand1

      default void setOperand1(IDExpression exp)
      Set the first operand. Same as setLeft(IDExpression).
      Parameters:
      exp -
    • getOperand2

      default IDExpression getOperand2()
      Retrieve the second operand. Same as getRight().
      Returns:
      never null
    • setOperand2

      default void setOperand2(IDExpression exp)
      Set the second operand. Same as setRight(IDExpression).
      Parameters:
      exp -
    • getLeft

      IDExpression getLeft()
      Returns:
      null for unary expressions
    • setLeft

      void setLeft(IDExpression exp)
      Parameters:
      exp -
    • getRight

      IDExpression getRight()
      Returns:
      never null
    • setRight

      void setRight(IDExpression exp)
      Parameters:
      exp -
    • getCondPredicate

      IDExpression getCondPredicate()
      If this IR is a conditional operation, retrieve the conditional's predicate.
      Returns:
      null for non conditional expressions
    • setCondPredicate

      void setCondPredicate(IDExpression pred)
    • getCondTrueExpression

      IDExpression getCondTrueExpression()
      If this IR is a conditional operation, retrieve the conditional's true expression. The same as getLeft().
      Returns:
    • getCondFalseExpression

      IDExpression getCondFalseExpression()
      If this IR is a conditional operation, retrieve the conditional's true expression. The same as getRight().
      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

      boolean isCast(IJavaType wantedType)
      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

      void updateConversionOperators(DTypeInfo ti, IDGlobalContext gctx)
      Upgrade temporary conversion operators to legal cast 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 conflicts
      gctx - global IR context (mandatory)
    • duplicate

      IDOperation duplicate()
      Description copied from interface: IDElement
      Duplicate this element.
      Specified by:
      duplicate in interface IDElement
      Specified by:
      duplicate in interface IDExpression
      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, assuming canReverse() returned true. This method throws on failure.