public abstract class IR extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
IR.SSA2LocalMap
A Map that gives the names of the local variables corresponding to SSA value numbers at particular IR instruction indices, if
such information is available from source code mapping.
|
Modifier | Constructor and Description |
---|---|
protected |
IR(IMethod method,
SSAInstruction[] instructions,
SymbolTable symbolTable,
SSACFG cfg,
SSAOptions options)
Simple constructor when someone else has already computed the symbol table and cfg.
|
Modifier and Type | Method and Description |
---|---|
ISSABasicBlock |
getBasicBlockForCatch(SSAGetCaughtExceptionInstruction instruction)
Return the
ISSABasicBlock corresponding to a particular catch instruction |
ISSABasicBlock |
getBasicBlockForInstruction(SSAInstruction s)
This is space-inefficient.
|
ISSABasicBlock[] |
getBasicBlocksForCall(CallSiteReference site) |
IntSet |
getCallInstructionIndices(CallSiteReference site)
Return the instruction indices corresponding to a call site.
|
SSAAbstractInvokeInstruction[] |
getCalls(CallSiteReference site)
Return the invoke instructions corresponding to a call site
Note that Shrike may inline JSRS.
|
SSACFG |
getControlFlowGraph() |
SSACFG.BasicBlock |
getExitBlock() |
protected abstract <T extends SSAIndirectionData.Name> |
getIndirectionData()
subclasses must provide information about indirect use of values, if appropriate, and otherwise null
|
SSAInstruction[] |
getInstructions()
Returns the normal instructions.
|
protected abstract IR.SSA2LocalMap |
getLocalMap()
subclasses must provide a source name mapping, if they want one (or null otherwise)
|
String[] |
getLocalNames(int index,
int vn) |
IMethod |
getMethod() |
SSANewInstruction |
getNew(NewSiteReference site)
Return the new instruction corresponding to an allocation site
|
int |
getNewInstructionIndex(NewSiteReference site)
Return the instruction index corresponding to an allocation site
|
int |
getNumberOfParameters() |
SSAOptions |
getOptions() |
int |
getParameter(int i) |
TypeReference |
getParameterType(int i)
Get the
TypeReference that describes the ith parameter to this method. |
int[] |
getParameterValueNumbers() |
SSAInstruction |
getPEI(ProgramCounter pc) |
SymbolTable |
getSymbolTable() |
protected abstract String |
instructionPosition(int instructionIndex) |
boolean |
isEmptyIR()
TODO: why do we need this? We should enforce instructions == null if necessary, I think.
|
Iterator<SSAInstruction> |
iterateAllInstructions() |
Iterator<CallSiteReference> |
iterateCallSites() |
Iterator<SSAInstruction> |
iterateCatchInstructions() |
Iterator<NewSiteReference> |
iterateNewSites() |
Iterator<SSAInstruction> |
iterateNormalInstructions() |
Iterator<? extends SSAInstruction> |
iteratePhis()
Return an
Iterator of all SSAPhiInstruction s for this IR. |
Iterator<? extends SSAInstruction> |
iteratePis()
Return an
Iterator of all SSAPiInstruction s for this IR. |
protected void |
setupLocationMap()
create mappings from call sites, new sites, and PEIs to instruction index
|
String |
toString() |
void |
visitAllInstructions(SSAInstruction.Visitor v)
visit each instruction in this IR
|
void |
visitNormalInstructions(SSAInstruction.Visitor v)
visit each normal (non-phi, non-pi, non-catch) instruction in this IR
|
protected IR(IMethod method, SSAInstruction[] instructions, SymbolTable symbolTable, SSACFG cfg, SSAOptions options)
protected abstract IR.SSA2LocalMap getLocalMap()
protected abstract <T extends SSAIndirectionData.Name> SSAIndirectionData<T> getIndirectionData()
protected void setupLocationMap()
protected abstract String instructionPosition(int instructionIndex)
public SSAInstruction[] getInstructions()
SSAPhiInstruction
, SSAPiInstruction
, or
SSAGetCaughtExceptionInstruction
s, which are currently managed by SSACFG.BasicBlock
. Entries in the returned array
might be null.
This may go away someday.public SymbolTable getSymbolTable()
SymbolTable
managing attributes for values in this methodpublic SSACFG getControlFlowGraph()
ControlFlowGraph
which defines this IR.public Iterator<? extends SSAInstruction> iteratePhis()
Iterator
of all SSAPhiInstruction
s for this IR.public Iterator<? extends SSAInstruction> iteratePis()
Iterator
of all SSAPiInstruction
s for this IR.public int[] getParameterValueNumbers()
public int getParameter(int i)
public TypeReference getParameterType(int i)
TypeReference
that describes the ith parameter to this method. By convention, for a non-static method, the 0th
parameter is "this".public int getNumberOfParameters()
public IMethod getMethod()
public Iterator<SSAInstruction> iterateCatchInstructions()
public void visitNormalInstructions(SSAInstruction.Visitor v)
public void visitAllInstructions(SSAInstruction.Visitor v)
public Iterator<SSAInstruction> iterateNormalInstructions()
Iterator
of all "normal" instructions on this IRpublic Iterator<SSAInstruction> iterateAllInstructions()
Iterator
of all instructions (Normal, Phi, and Catch)public SSACFG.BasicBlock getExitBlock()
public SSAAbstractInvokeInstruction[] getCalls(CallSiteReference site)
public IntSet getCallInstructionIndices(CallSiteReference site)
public SSANewInstruction getNew(NewSiteReference site)
public int getNewInstructionIndex(NewSiteReference site)
public SSAInstruction getPEI(ProgramCounter pc)
pc
- a program counterpublic Iterator<NewSiteReference> iterateNewSites()
Iterator
of all the allocation sites ( NewSiteReference
s ) in this IRpublic Iterator<CallSiteReference> iterateCallSites()
Iterator
of all the call sites ( CallSiteReference
s ) in this IRpublic ISSABasicBlock[] getBasicBlocksForCall(CallSiteReference site)
site
- a call site in this methodIllegalArgumentException
- if site is nullpublic ISSABasicBlock getBasicBlockForInstruction(SSAInstruction s)
public boolean isEmptyIR()
public String[] getLocalNames(int index, int vn)
index
- an index into the IR instruction arrayvn
- a value numberpublic ISSABasicBlock getBasicBlockForCatch(SSAGetCaughtExceptionInstruction instruction)
ISSABasicBlock
corresponding to a particular catch instructionpublic SSAOptions getOptions()
SSAOptions
which controlled how this IR
was built