Class SSAInstruction
- Direct Known Subclasses:
AstAssertInstruction
,AstConsumeInstruction
,AstIsDefinedInstruction
,AstLexicalAccess
,EnclosingObjectReference
,JavaScriptCheckReference
,JavaScriptInstanceOf
,JavaScriptWithRegion
,ReflectiveMemberAccess
,SetPrototype
,SSAAbstractBinaryInstruction
,SSAAbstractInvokeInstruction
,SSAAbstractThrowInstruction
,SSAAbstractUnaryInstruction
,SSAAddressOfInstruction
,SSAArrayLengthInstruction
,SSAArrayReferenceInstruction
,SSACheckCastInstruction
,SSAComparisonInstruction
,SSAConditionalBranchInstruction
,SSAConversionInstruction
,SSAFieldAccessInstruction
,SSAGetCaughtExceptionInstruction
,SSAGotoInstruction
,SSAInstanceofInstruction
,SSALoadMetadataInstruction
,SSAMonitorInstruction
,SSANewInstruction
,SSAPhiInstruction
,SSAReturnInstruction
,SSAStoreIndirectInstruction
,SSASwitchInstruction
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
This interface is used by Instruction.visit to dispatch based on the instruction type.static class
A base visitor implementation that does nothing. -
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
SSAInstruction
(int iindex) prevent instantiation by the outside -
Method Summary
Modifier and TypeMethodDescriptionabstract SSAInstruction
copyForSSA
(SSAInstructionFactory insts, int[] defs, int[] uses) This method is meant to be used during SSA conversion for an IR that is not in SSA form.final boolean
We assume these instructions are canonical and managed by a governing IR object.int
getDef()
int
getDef
(int i) Return the ith defThis method should never return null.int
int
int
getUse
(int j) protected String
getValueString
(SymbolTable symbolTable, int valueNumber) boolean
hasDef()
Does this instruction define a normal value, as distinct from a set of exceptions possibly thrown by it (e.g.abstract int
hashCode()
int
iIndex()
abstract boolean
boolean
isPEI()
void
setInstructionIndex
(int instructionIndex) toString()
abstract String
toString
(SymbolTable symbolTable) abstract void
Apply an IVisitor to this instruction.
-
Field Details
-
NO_INDEX
public static final int NO_INDEX- See Also:
-
-
Constructor Details
-
SSAInstruction
protected SSAInstruction(int iindex) prevent instantiation by the outside
-
-
Method Details
-
copyForSSA
This method is meant to be used during SSA conversion for an IR that is not in SSA form. It creates a new SSAInstruction of the same type as the receiver, with a combination of the receiver's uses and defs and those from the method parameters.In particular, if the 'defs' parameter is null, then the new instruction has the same defs as the receiver. If 'defs' is not null, it must be an array with a size equal to the number of defs that the receiver instruction has. In this case, the new instruction has defs taken from the array. The uses of the new instruction work in the same way with the 'uses' parameter.
Note that this only applies to CAst-based IR translation, since Java bytecode-based IR generation uses a different SSA construction mechanism.
TODO: move this into the SSAInstructionFactory
-
toString
-
toString
-
getValueString
-
visit
Apply an IVisitor to this instruction. We invoke the appropriate IVisitor method according to the type of this instruction. -
hasDef
public boolean hasDef()Does this instruction define a normal value, as distinct from a set of exceptions possibly thrown by it (e.g. for invoke instructions).- Returns:
- true if the instruction does define a proper value.
-
getDef
public int getDef() -
getDef
public int getDef(int i) Return the ith def- Parameters:
i
- number of the def, starting at 0.
-
getNumberOfDefs
public int getNumberOfDefs() -
getNumberOfUses
public int getNumberOfUses() -
getUse
- Returns:
- value number representing the jth use in this instruction. -1 means TOP (i.e., the value doesn't matter)
- Throws:
UnsupportedOperationException
-
hashCode
-
isPEI
public boolean isPEI()- Returns:
- true iff this instruction may throw an exception.
-
getExceptionTypes
This method should never return null.- Returns:
- the set of exception types that an instruction might throw ... disregarding athrows and invokes.
-
isFallThrough
public abstract boolean isFallThrough()- Returns:
- true iff this instruction may fall through to the next
-
equals
We assume these instructions are canonical and managed by a governing IR object. Be careful.Depending on the caching policy (see
SSACache
), the governing IR may be deleted to reclaim memory and recomputed as needed. When an IR is recomputed, it also creates fresh SSAInstruction objects that will not equal old ones. Thus, do not compare for identity SSAInstructions obtained from distinct calls that retrieve cached values (e.g. distinct CGNode.getIR() calls). See the github issue for details. -
iIndex
public int iIndex() -
setInstructionIndex
public void setInstructionIndex(int instructionIndex)
-