Class ArrayAccessInstruction


  • public class ArrayAccessInstruction
    extends IRInstruction
    An array element load or store, distinguished by its AccessMode.
    • Method Detail

      • createLoad

        public static ArrayAccessInstruction createLoad​(SSAValue result,
                                                        Value array,
                                                        Value index)
        Creates an array element load.
        Parameters:
        result - the SSA value receiving the loaded element
        array - the array reference
        index - the element index
        Returns:
        the load instruction
      • createStore

        public static ArrayAccessInstruction createStore​(Value array,
                                                         Value index,
                                                         Value value)
        Creates an array element store.
        Parameters:
        array - the array reference
        index - the element index
        value - the value to store
        Returns:
        the store instruction
      • getMode

        public AccessMode getMode()
        Returns:
        the mode
      • getArray

        public Value getArray()
        Returns:
        the array
      • getIndex

        public Value getIndex()
        Returns:
        the index
      • getValue

        public Value getValue()
        Returns:
        the value
      • isLoad

        public boolean isLoad()
        Returns:
        true if this access is a load
      • isStore

        public boolean isStore()
        Returns:
        true if this access is a store
      • 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