Package com.tonic.analysis.ssa.ir
Class NewArrayInstruction
- java.lang.Object
-
- com.tonic.analysis.ssa.ir.IRInstruction
-
- com.tonic.analysis.ssa.ir.NewArrayInstruction
-
public class NewArrayInstruction extends IRInstruction
An array allocation covering newarray, anewarray, and multianewarray.
-
-
Constructor Summary
Constructors Constructor Description NewArrayInstruction(SSAValue result, IRType elementType, Value length)Creates a one-dimensional array allocation.NewArrayInstruction(SSAValue result, IRType elementType, List<Value> dimensions)Creates a multi-dimensional array allocation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Taccept(IRVisitor<T> visitor)Accepts a visitor for this instruction.List<Value>getDimensions()IRTypegetElementType()List<Value>getOperands()Gets the operands used by this instruction.booleanisMultiDimensional()Checks if this is a multi-dimensional array allocation.voidreplaceOperand(Value oldValue, Value newValue)Replaces an operand value with a new value.StringtoString()-
Methods inherited from class com.tonic.analysis.ssa.ir.IRInstruction
copyWithNewOperands, equals, getBlock, getBytecodeOffset, getId, getResult, getResultType, hashCode, hasResult, isPhi, isTerminator, replaceTarget, resetIdCounter, setBlock, setBytecodeOffset, setResult
-
-
-
-
Constructor Detail
-
NewArrayInstruction
public NewArrayInstruction(SSAValue result, IRType elementType, Value length)
Creates a one-dimensional array allocation.- Parameters:
result- the SSA value receiving the array referenceelementType- the element typelength- the array length
-
NewArrayInstruction
public NewArrayInstruction(SSAValue result, IRType elementType, List<Value> dimensions)
Creates a multi-dimensional array allocation.- Parameters:
result- the SSA value receiving the array referenceelementType- the element typedimensions- the length of each allocated dimension
-
-
Method Detail
-
getElementType
public IRType getElementType()
- Returns:
- the element type
-
isMultiDimensional
public boolean isMultiDimensional()
Checks if this is a multi-dimensional array allocation.- Returns:
- true if array has multiple dimensions
-
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
-
-