public abstract class SSAInstruction
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
SSAInstruction.IVisitor
This interface is used by Instruction.visit to dispatch based on the instruction type.
|
static class |
SSAInstruction.Visitor
A base visitor implementation that does nothing.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
NO_INDEX |
| Modifier | Constructor and Description |
|---|---|
protected |
SSAInstruction(int iindex)
prevent instantiation by the outside
|
| Modifier and Type | Method and Description |
|---|---|
abstract 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.
|
boolean |
equals(java.lang.Object obj)
We assume these instructions are canonical and managed by a governing IR object.
|
int |
getDef() |
int |
getDef(int i)
Return the ith def
|
java.util.Collection<TypeReference> |
getExceptionTypes()
This method should never return null.
|
int |
getNumberOfDefs() |
int |
getNumberOfUses() |
int |
getUse(int j) |
protected java.lang.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 |
isFallThrough() |
boolean |
isPEI() |
void |
setInstructionIndex(int instructionIndex) |
java.lang.String |
toString() |
abstract java.lang.String |
toString(SymbolTable symbolTable) |
abstract void |
visit(SSAInstruction.IVisitor v)
Apply an IVisitor to this instruction.
|
public static final int NO_INDEX
protected SSAInstruction(int iindex)
public abstract SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses)
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
public abstract java.lang.String toString(SymbolTable symbolTable)
public java.lang.String toString()
toString in class java.lang.Objectprotected java.lang.String getValueString(SymbolTable symbolTable, int valueNumber)
public abstract void visit(SSAInstruction.IVisitor v)
public boolean hasDef()
public int getDef()
public int getDef(int i)
i - number of the def, starting at 0.public int getNumberOfDefs()
public int getNumberOfUses()
public int getUse(int j)
throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationExceptionpublic abstract int hashCode()
hashCode in class java.lang.Objectpublic boolean isPEI()
public java.util.Collection<TypeReference> getExceptionTypes()
public abstract boolean isFallThrough()
public final boolean equals(java.lang.Object obj)
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.
equals in class java.lang.Objectpublic int iIndex()
public void setInstructionIndex(int instructionIndex)