public class SSAPiInstruction extends SSAUnaryOpInstruction
IR with or without Pi instructions, depending on SSAOptions selected.
A Pi instruction is linked to its "cause" instruction, which is usually a conditional branch.
For example, the following pseudo-code
boolean condition = (x instanceof Integer);
if (condition) {
S1;
else {
S2;
}
could be translated roughly as follows:
boolean condition = (x instanceof Integer);
LABEL1: if (condition) {
x_1 = pi(x, LABEL1);
S1;
else {
x_2 = pi(x, LABEL2);
S2;
}
SSAInstruction.IVisitor, SSAInstruction.Visitorresult, valNO_INDEX| Constructor and Description |
|---|
SSAPiInstruction(int iindex,
int result,
int val,
int piBlock,
int successorBlock,
SSAInstruction cause) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
SSAInstruction |
getCause() |
int |
getPiBlock() |
int |
getSuccessor() |
int |
getVal() |
java.lang.String |
toString(SymbolTable symbolTable) |
void |
visit(SSAInstruction.IVisitor v)
Apply an IVisitor to this instruction.
|
getOpcodegetDef, getDef, getNumberOfDefs, getNumberOfUses, getUse, hasDef, hashCode, isFallThroughequals, getExceptionTypes, getValueString, iIndex, isPEI, setInstructionIndex, toStringpublic SSAPiInstruction(int iindex,
int result,
int val,
int piBlock,
int successorBlock,
SSAInstruction cause)
successorBlock - the successor block; this PI assignment happens on the transition between
this basic block and the successor block.public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses)
SSAInstructionIn 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
copyForSSA in class SSAUnaryOpInstructionpublic java.lang.String toString(SymbolTable symbolTable)
toString in class SSAUnaryOpInstructionpublic void visit(SSAInstruction.IVisitor v)
SSAInstructionvisit in class SSAUnaryOpInstructionSSAInstruction.visit(IVisitor)public int getSuccessor()
public int getPiBlock()
public SSAInstruction getCause()
public int getVal()