public class LocalCSE extends CompilerPhase
Modifier and Type | Class and Description |
---|---|
private static class |
LocalCSE.AvailableExpression
A tuple to record an Available Expression
|
protected static class |
LocalCSE.AvExCache
Implements a cache of Available Expressions
|
Modifier and Type | Field and Description |
---|---|
private static Constructor<CompilerPhase> |
constructor
Constructor for this compiler phase
|
private boolean |
isHIR |
container
Constructor and Description |
---|
LocalCSE(boolean isHIR) |
Modifier and Type | Method and Description |
---|---|
private void |
checkHelper(IR ir,
LocalCSE.AvExCache cache,
Instruction inst)
Process a check instruction
|
private void |
expressionHelper(IR ir,
LocalCSE.AvExCache cache,
Instruction inst)
Process a unary or binary expression.
|
Constructor<CompilerPhase> |
getClassConstructor()
Get a constructor object for this compiler phase
|
private static Operator |
getMoveOp(RegisterOperand r) |
String |
getName() |
private boolean |
isCheck(Instruction inst)
Is the given instruction a check instruction?
|
private boolean |
isExpression(Instruction inst)
Does the instruction compute some expression?
|
static boolean |
isLoadInstruction(Instruction s) |
static boolean |
isStoreInstruction(Instruction s) |
private static boolean |
isSynchronizing(Instruction inst) |
private boolean |
isTypeCheck(Instruction inst) |
private void |
loadHelper(IR ir,
LocalCSE.AvExCache cache,
Instruction inst)
Process a load instruction
|
private void |
optimizeBasicBlockHIR(IR ir,
BasicBlock bb)
Perform Local CSE for a basic block in HIR.
|
private void |
optimizeBasicBlockLIR(IR ir,
BasicBlock bb)
Perform Local CSE for a basic block in LIR.
|
void |
perform(IR ir)
Perform Local CSE for a method.
|
void |
reportAdditionalStats()
Called when printing a measure compilation report to enable a phase
to report additional phase-specific statistics.
|
boolean |
shouldPerform(OptOptions options)
This method determines if the phase should be run, based on the
Options object it is passed.
|
private void |
storeHelper(LocalCSE.AvExCache cache,
Instruction inst)
Process a store instruction
|
private static void |
typeCheckHelper(IR ir,
LocalCSE.AvExCache cache,
Instruction inst)
Process a type check instruction
|
dumpIR, dumpIR, getCompilerPhaseConstructor, getCompilerPhaseConstructor, newExecution, performPhase, printingEnabled, setContainer, verify
private final boolean isHIR
private static final Constructor<CompilerPhase> constructor
public LocalCSE(boolean isHIR)
public Constructor<CompilerPhase> getClassConstructor()
getClassConstructor
in class CompilerPhase
public final void reportAdditionalStats()
CompilerPhase
reportAdditionalStats
in class CompilerPhase
public final boolean shouldPerform(OptOptions options)
CompilerPhase
shouldPerform
in class CompilerPhase
options
- the compiler options for the compilationpublic final String getName()
getName
in class CompilerPhase
public final void perform(IR ir)
perform
in class CompilerPhase
ir
- the IR to optimizeprivate void optimizeBasicBlockHIR(IR ir, BasicBlock bb)
ir
- the method's irbb
- the basic blockprivate void optimizeBasicBlockLIR(IR ir, BasicBlock bb)
ir
- the method's irbb
- the basic blockpublic static boolean isLoadInstruction(Instruction s)
public static boolean isStoreInstruction(Instruction s)
private boolean isExpression(Instruction inst)
inst
- the instruction in questionprivate boolean isCheck(Instruction inst)
inst
- the instruction in questionprivate boolean isTypeCheck(Instruction inst)
private void loadHelper(IR ir, LocalCSE.AvExCache cache, Instruction inst)
ir
- the containing IR object.cache
- the cache of available expressionsinst
- the instruction begin processedprivate void storeHelper(LocalCSE.AvExCache cache, Instruction inst)
cache
- the cache of available expressionsinst
- the instruction begin processedprivate void expressionHelper(IR ir, LocalCSE.AvExCache cache, Instruction inst)
ir
- the containing IR objectcache
- the cache of available expressionsinst
- the instruction begin processedprivate void checkHelper(IR ir, LocalCSE.AvExCache cache, Instruction inst)
ir
- the IR that contains the instructioncache
- the cache of available expressionsinst
- the instruction begin processedprivate static void typeCheckHelper(IR ir, LocalCSE.AvExCache cache, Instruction inst)
ir
- Unusedcache
- The cache of available expressions.inst
- The instruction being processedprivate static Operator getMoveOp(RegisterOperand r)
private static boolean isSynchronizing(Instruction inst)
inst
- the instruction in question