|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.compilers.opt.driver.CompilerPhase org.jikesrvm.compilers.opt.ssa.LICM
public class LICM
This class does loop invariant code movement. It is a subphase of GCP
(global code placement).
Field Summary | |
---|---|
private BasicBlock[] |
block
|
(package private) static int |
CL_COMPLEX
|
(package private) static int |
CL_LOADS_AND_STORES
|
(package private) static int |
CL_LOADS_ONLY
|
(package private) static int |
CL_NONE
|
(package private) static int |
CL_STORES_ONLY
|
private static Constructor<CompilerPhase> |
constructor
Constructor for this compiler phase |
private static boolean |
DEBUG
Generate debug output? |
private DominatorTree |
dominator
|
private static int |
done
|
private static int |
early
|
private Instruction[] |
earlyPos
|
private static int |
initial
|
private IR |
ir
|
private static int |
late
|
private HashSet<Operator> |
moved
|
private BasicBlock[] |
origBlock
|
private HashSet<Instruction> |
relocated
|
private SSADictionary |
ssad
|
private int[] |
state
|
private static boolean |
VERBOSE
Generate verbose debug output? |
Fields inherited from class org.jikesrvm.compilers.opt.driver.CompilerPhase |
---|
container |
Constructor Summary | |
---|---|
LICM()
|
Method Summary | |
---|---|
private int |
_checkLoop(Instruction inst,
HeapOperand<?> hop,
int xidx)
check that inside the loop, the heap variable is only used/defed by simple, non-volatile loads/stores returns one of: CL_LOADS_ONLY, CL_STORES_ONLY, CL_LOADS_AND_STORES, CL_COMPLEX |
private int |
checkLoop(Instruction inst,
HeapOperand<Object> hop,
int xidx,
BasicBlock block)
check that inside the loop, the heap variable is only used/defed by simple, non-volatile loads/stores returns one of: CL_LOADS_ONLY, CL_STORES_ONLY, CL_LOADS_AND_STORES, CL_COMPLEX |
private BasicBlock |
commonDominator(BasicBlock a,
BasicBlock b)
|
(package private) Instruction |
definingInstruction(Operand op)
Return the instruction that defines the operand. |
private Instruction |
dominanceSuccessor(Instruction a,
Instruction b)
return `a's successor on the path from `a' to `b' in the dominator tree. |
(package private) float |
frequency(BasicBlock b)
How expensive is it to place an instruction in this block? |
(package private) BasicBlock |
getBlock(Instruction inst)
Get the basic block of an instruction |
Constructor<CompilerPhase> |
getClassConstructor()
Get a constructor object for this compiler phase |
(package private) Instruction |
getEarlyPos(Instruction inst)
Get the early position of an instruction |
String |
getName()
Returns the name of the phase |
(package private) BasicBlock |
getOrigBlock(Instruction inst)
Get the block, where the instruction was originally located |
(package private) Operand |
getResult(Instruction inst)
Get the result operand of the instruction |
(package private) int |
getState(Instruction inst)
In what state (initial, early, late, done) is this instruction |
(package private) void |
initialize(IR ir)
initialize the state of the algorithm |
private boolean |
inVariantLocation(Instruction inst,
BasicBlock block)
|
private Instruction |
maxDominatorDepth(Instruction a,
Instruction b)
compare a and b according to their depth in the dominator tree and return the one with the greatest depth. |
(package private) void |
move(Instruction inst,
BasicBlock to)
move `inst' behind `pred' |
void |
perform(IR ir)
Execute loop invariant code motion on the given IR. |
(package private) boolean |
postDominates(BasicBlock a,
BasicBlock b)
does a post dominate b? |
private boolean |
replaceUses(Instruction inst,
HeapOperand<?> replacement,
BasicBlockOperand replacementBlock,
boolean onlyPEIs)
In the consumers of `inst', replace uses of `inst's result with uses of `replacement' |
private void |
resetLandingPads()
|
private Instruction |
scheduleEarly(Instruction inst)
Schedule this instruction as early as possible |
(package private) Instruction |
scheduleHeapDefsEarly(HeapOperand<?>[] op,
Instruction earlyPos,
Instruction me)
Schedule me as early as possible, but behind the definitions of op[i] and behind earlyPos |
(package private) BasicBlock |
scheduleHeapUsesLate(Instruction inst,
BasicBlock lateBlock)
Schedule me as early as possible, but behind the definitions of op[i] and behind earlyPos |
(package private) BasicBlock |
scheduleLate(Instruction inst)
Schedule as late as possible. |
private Instruction |
scheduleScalarDefsEarly(Enumeration<Operand> e,
Instruction earlyPos,
Instruction inst)
Schedule me as early as possible, but behind the definitions in e and behind earlyPos |
private BasicBlock |
scheduleScalarUsesLate(Instruction inst,
BasicBlock lateBlock)
Schedule me as late as possible, but in front of my uses and before latePos |
(package private) void |
setBlock(Instruction inst,
BasicBlock b)
Set the basic block for an instruction |
(package private) void |
setEarlyPos(Instruction inst,
Instruction pos)
Set the early position for an instruction |
(package private) void |
setOrigBlock(Instruction inst,
BasicBlock b)
Set the block, where the instruction is originally located. |
(package private) void |
setState(Instruction inst,
int s)
Set the state (initial, early, late, done) of the instruction |
static boolean |
shouldMove(Instruction inst,
IR ir)
Is it save to move the given instruction, depending on we are in heapSSA form or not? |
boolean |
shouldPerform(OptOptions options)
This method determines if the phase should be run, based on the Options object it is passed. |
private boolean |
simplify(Instruction inst,
BasicBlock block)
|
(package private) BasicBlock |
upto(Instruction earlyPos,
BasicBlock lateBlock,
Instruction inst)
Visit the blocks between the late and the early position along their path in the dominator tree. |
(package private) BasicBlock |
useBlock(Instruction use,
Operand op)
|
private boolean |
useDominates(Operand op,
BasicBlock block)
|
Methods inherited from class org.jikesrvm.compilers.opt.driver.CompilerPhase |
---|
dumpIR, dumpIR, getCompilerPhaseConstructor, getCompilerPhaseConstructor, newExecution, performPhase, printingEnabled, reportAdditionalStats, setContainer, verify |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final boolean DEBUG
private static boolean VERBOSE
private static final Constructor<CompilerPhase> constructor
private static final int initial
private static final int early
private static final int late
private static final int done
private HashSet<Instruction> relocated
private int[] state
private BasicBlock[] block
private BasicBlock[] origBlock
private Instruction[] earlyPos
private SSADictionary ssad
private DominatorTree dominator
private IR ir
private final HashSet<Operator> moved
static final int CL_NONE
static final int CL_LOADS_ONLY
static final int CL_STORES_ONLY
static final int CL_LOADS_AND_STORES
static final int CL_COMPLEX
Constructor Detail |
---|
public LICM()
Method Detail |
---|
public Constructor<CompilerPhase> getClassConstructor()
getClassConstructor
in class CompilerPhase
public void perform(IR ir)
perform
in class CompilerPhase
ir
- the IR on which to apply the phasepublic String getName()
getName
in class CompilerPhase
public boolean shouldPerform(OptOptions options)
CompilerPhase
shouldPerform
in class CompilerPhase
options
- the compiler options for the compilation
true
if SSA-based global code placement is being
performedpublic static boolean shouldMove(Instruction inst, IR ir)
inst
- ir
- private Instruction scheduleEarly(Instruction inst)
inst
- BasicBlock scheduleLate(Instruction inst)
inst
- private Instruction dominanceSuccessor(Instruction a, Instruction b)
private Instruction maxDominatorDepth(Instruction a, Instruction b)
private BasicBlock commonDominator(BasicBlock a, BasicBlock b)
private Instruction scheduleScalarDefsEarly(Enumeration<Operand> e, Instruction earlyPos, Instruction inst)
Instruction scheduleHeapDefsEarly(HeapOperand<?>[] op, Instruction earlyPos, Instruction me)
BasicBlock useBlock(Instruction use, Operand op)
private BasicBlock scheduleScalarUsesLate(Instruction inst, BasicBlock lateBlock)
BasicBlock scheduleHeapUsesLate(Instruction inst, BasicBlock lateBlock)
Instruction definingInstruction(Operand op)
op
- Operand getResult(Instruction inst)
inst
- BasicBlock upto(Instruction earlyPos, BasicBlock lateBlock, Instruction inst)
final float frequency(BasicBlock b)
void move(Instruction inst, BasicBlock to)
boolean postDominates(BasicBlock a, BasicBlock b)
a
- b
- BasicBlock getBlock(Instruction inst)
inst
- void setBlock(Instruction inst, BasicBlock b)
inst
- b
- Instruction getEarlyPos(Instruction inst)
inst
- void setEarlyPos(Instruction inst, Instruction pos)
inst
- pos
- BasicBlock getOrigBlock(Instruction inst)
inst
- void setOrigBlock(Instruction inst, BasicBlock b)
inst
- b
- int getState(Instruction inst)
inst
- void setState(Instruction inst, int s)
inst
- s
- void initialize(IR ir)
private boolean simplify(Instruction inst, BasicBlock block)
private int _checkLoop(Instruction inst, HeapOperand<?> hop, int xidx)
returns one of: CL_LOADS_ONLY, CL_STORES_ONLY, CL_LOADS_AND_STORES, CL_COMPLEX
private int checkLoop(Instruction inst, HeapOperand<Object> hop, int xidx, BasicBlock block)
returns one of: CL_LOADS_ONLY, CL_STORES_ONLY, CL_LOADS_AND_STORES, CL_COMPLEX
private boolean inVariantLocation(Instruction inst, BasicBlock block)
private boolean useDominates(Operand op, BasicBlock block)
private boolean replaceUses(Instruction inst, HeapOperand<?> replacement, BasicBlockOperand replacementBlock, boolean onlyPEIs)
private void resetLandingPads()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |