Class BinaryOpInstruction


  • public class BinaryOpInstruction
    extends IRInstruction
    A binary arithmetic, logical, or comparison operation on two operands.
    • Constructor Detail

      • BinaryOpInstruction

        public BinaryOpInstruction​(SSAValue result,
                                   BinaryOp op,
                                   Value left,
                                   Value right)
        Creates a binary operation and registers uses of its SSA operands.
        Parameters:
        result - the SSA value receiving the result
        op - the operation to perform
        left - the left operand
        right - the right operand
    • Method Detail

      • getOp

        public BinaryOp getOp()
        Returns:
        the op
      • getLeft

        public Value getLeft()
        Returns:
        the left
      • getRight

        public Value getRight()
        Returns:
        the right
      • replaceOperand

        public void replaceOperand​(Value oldValue,
                                   Value newValue)
        Description copied from class: IRInstruction
        Replaces an operand value with a new value.
        Specified by:
        replaceOperand in class IRInstruction
        Parameters:
        oldValue - the value to replace
        newValue - the replacement value
      • accept

        public <T> T accept​(IRVisitor<T> visitor)
        Description copied from class: IRInstruction
        Accepts a visitor for this instruction.
        Specified by:
        accept in class IRInstruction
        Type Parameters:
        T - the return type
        Parameters:
        visitor - the visitor to accept
        Returns:
        the visitor result
      • copyWithNewOperands

        public IRInstruction copyWithNewOperands​(SSAValue newResult,
                                                 List<Value> newOperands)
        Description copied from class: IRInstruction
        Creates a copy of this instruction with new result and operands.
        Overrides:
        copyWithNewOperands in class IRInstruction
        Parameters:
        newResult - the new result value (may be null)
        newOperands - the new operand values
        Returns:
        a copy of this instruction, or null if copying not supported
      • swapOperands

        public void swapOperands()
        Swaps the two operands in place.