Package com.tonic.analysis.ssa.ir
Class FieldAccessInstruction
- java.lang.Object
-
- com.tonic.analysis.ssa.ir.IRInstruction
-
- com.tonic.analysis.ssa.ir.FieldAccessInstruction
-
public class FieldAccessInstruction extends IRInstruction
A static or instance field 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 FieldAccessInstructioncreateLoad(SSAValue result, String owner, String name, String descriptor, Value objectRef)Creates an instance field load.static FieldAccessInstructioncreateStaticLoad(SSAValue result, String owner, String name, String descriptor)Creates a static field load.static FieldAccessInstructioncreateStaticStore(String owner, String name, String descriptor, Value value)Creates a static field store.static FieldAccessInstructioncreateStore(String owner, String name, String descriptor, Value objectRef, Value value)Creates an instance field store.StringgetDescriptor()AccessModegetMode()StringgetName()ValuegetObjectRef()List<Value>getOperands()Gets the operands used by this instruction.StringgetOwner()ValuegetValue()booleanisLoad()booleanisStatic()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 FieldAccessInstruction createLoad(SSAValue result, String owner, String name, String descriptor, Value objectRef)
Creates an instance field load.- Parameters:
result- the SSA value receiving the field valueowner- the internal name of the declaring classname- the field namedescriptor- the field descriptorobjectRef- the receiver object- Returns:
- the load instruction
-
createStaticLoad
public static FieldAccessInstruction createStaticLoad(SSAValue result, String owner, String name, String descriptor)
Creates a static field load.- Parameters:
result- the SSA value receiving the field valueowner- the internal name of the declaring classname- the field namedescriptor- the field descriptor- Returns:
- the load instruction
-
createStore
public static FieldAccessInstruction createStore(String owner, String name, String descriptor, Value objectRef, Value value)
Creates an instance field store.- Parameters:
owner- the internal name of the declaring classname- the field namedescriptor- the field descriptorobjectRef- the receiver objectvalue- the value to store- Returns:
- the store instruction
-
createStaticStore
public static FieldAccessInstruction createStaticStore(String owner, String name, String descriptor, Value value)
Creates a static field store.- Parameters:
owner- the internal name of the declaring classname- the field namedescriptor- the field descriptorvalue- the value to store- Returns:
- the store instruction
-
getMode
public AccessMode getMode()
- Returns:
- the mode
-
getOwner
public String getOwner()
- Returns:
- the owner
-
getName
public String getName()
- Returns:
- the name
-
getDescriptor
public String getDescriptor()
- Returns:
- the descriptor
-
isStatic
public boolean isStatic()
- Returns:
- whether static
-
getObjectRef
public Value getObjectRef()
- Returns:
- the object ref
-
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
-
-