Class TypeCheckInstruction


  • public class TypeCheckInstruction
    extends IRInstruction
    A checkcast or instanceof test, distinguished by its TypeCheckOp.
    • Method Detail

      • createCast

        public static TypeCheckInstruction createCast​(SSAValue result,
                                                      Value operand,
                                                      IRType targetType)
        Creates a checkcast.
        Parameters:
        result - the SSA value receiving the cast reference
        operand - the reference to cast
        targetType - the type to cast to
        Returns:
        the cast instruction
      • createInstanceOf

        public static TypeCheckInstruction createInstanceOf​(SSAValue result,
                                                            Value operand,
                                                            IRType checkType)
        Creates an instanceof test.
        Parameters:
        result - the SSA value receiving the boolean result
        operand - the reference to test
        checkType - the type to test against
        Returns:
        the instanceof instruction
      • getOperand

        public Value getOperand()
        Returns:
        the operand
      • getTargetType

        public IRType getTargetType()
        Returns:
        the target type
      • isCast

        public boolean isCast()
        Returns:
        true if this is a checkcast
      • isInstanceOf

        public boolean isInstanceOf()
        Returns:
        true if this is an instanceof test
      • 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