Class ReturnInstruction


  • public class ReturnInstruction
    extends IRInstruction
    A method return, with or without a value.
    • Constructor Detail

      • ReturnInstruction

        public ReturnInstruction()
        Creates a void return.
      • ReturnInstruction

        public ReturnInstruction​(Value returnValue)
        Creates a value return and registers a use of an SSA return value.
        Parameters:
        returnValue - the value to return
    • Method Detail

      • getReturnValue

        public Value getReturnValue()
        Returns:
        the return value
      • isVoidReturn

        public boolean isVoidReturn()
        Checks if this is a void return.
        Returns:
        true if returning void
      • 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
      • isTerminator

        public boolean isTerminator()
        Description copied from class: IRInstruction
        Checks if this instruction terminates a basic block.
        Overrides:
        isTerminator in class IRInstruction
        Returns:
        true if this is a terminator instruction
      • 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