Package com.tonic.analysis.ssa.ir
Class ArrayAccessInstruction
- java.lang.Object
-
- com.tonic.analysis.ssa.ir.IRInstruction
-
- com.tonic.analysis.ssa.ir.ArrayAccessInstruction
-
public class ArrayAccessInstruction extends IRInstruction
An array element load or store, distinguished by itsAccessMode.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Taccept(IRVisitor<T> visitor)Accepts a visitor for this instruction.IRInstructioncopyWithNewOperands(SSAValue newResult, List<Value> newOperands)Creates a copy of this instruction with new result and operands.static ArrayAccessInstructioncreateLoad(SSAValue result, Value array, Value index)Creates an array element load.static ArrayAccessInstructioncreateStore(Value array, Value index, Value value)Creates an array element store.ValuegetArray()ValuegetIndex()AccessModegetMode()List<Value>getOperands()Gets the operands used by this instruction.ValuegetValue()booleanisLoad()booleanisStore()voidreplaceOperand(Value oldValue, Value newValue)Replaces an operand value with a new value.StringtoString()-
Methods inherited from class com.tonic.analysis.ssa.ir.IRInstruction
equals, getBlock, getBytecodeOffset, getId, getResult, getResultType, hashCode, hasResult, isPhi, isTerminator, replaceTarget, resetIdCounter, setBlock, setBytecodeOffset, setResult
-
-
-
-
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 elementarray- the array referenceindex- 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 referenceindex- the element indexvalue- 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
-
getOperands
public List<Value> getOperands()
Description copied from class:IRInstructionGets the operands used by this instruction.- Specified by:
getOperandsin classIRInstruction- Returns:
- list of operand values
-
replaceOperand
public void replaceOperand(Value oldValue, Value newValue)
Description copied from class:IRInstructionReplaces an operand value with a new value.- Specified by:
replaceOperandin classIRInstruction- Parameters:
oldValue- the value to replacenewValue- the replacement value
-
accept
public <T> T accept(IRVisitor<T> visitor)
Description copied from class:IRInstructionAccepts a visitor for this instruction.- Specified by:
acceptin classIRInstruction- 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:IRInstructionCreates a copy of this instruction with new result and operands.- Overrides:
copyWithNewOperandsin classIRInstruction- 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
-
-