|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.compilers.opt.driver.OptimizationPlanElement org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement org.jikesrvm.compilers.opt.ssa.LoadElimination
public final class LoadElimination
This class implements the redundant load elimination by Fink, Knobe && Sarkar. See SAS 2000 paper for details.
Nested Class Summary | |
---|---|
static class |
LoadElimination.GVNPreparation
This class sets up the IR state prior to entering SSA for GVN. |
static class |
LoadElimination.LoadEliminationPreparation
This class sets up the IR state prior to entering SSA for load elimination |
(package private) static class |
LoadElimination.LoadEliminator
|
(package private) static class |
LoadElimination.UseRecord
|
(package private) static class |
LoadElimination.UseRecordSet
|
Field Summary | |
---|---|
(package private) static boolean |
DEBUG
|
private int |
round
which round of load elimination is this? |
Constructor Summary | |
---|---|
LoadElimination(int round)
|
Method Summary | ||
---|---|---|
(package private) static void |
appendMove(Register r,
Operand src,
Instruction store)
Append an instruction after a store instruction that caches value in register r. |
|
(package private) static boolean |
eliminateLoads(IR ir,
DF_Solution available)
Eliminate redundant loads with respect to prior defs and prior uses. |
|
private static
|
findOrCreateIndexSet(HashMap<Object,HashSet<T>> map,
Object key)
|
|
(package private) static Register |
findOrCreateRegister(Object heapType,
int valueNumber,
HashMap<LoadElimination.UseRecord,Register> registers,
ArchitectureSpecificOpt.RegisterPool pool,
TypeReference type)
Given a value number, return the temporary register allocated for that value number. |
|
(package private) static Register |
findOrCreateRegister(Object heapType,
int v1,
int v2,
HashMap<LoadElimination.UseRecord,Register> registers,
ArchitectureSpecificOpt.RegisterPool pool,
TypeReference type)
Given a pair of value numbers, return the temporary register allocated for that pair. |
|
static HashSet<Object> |
getCandidates(IR ir)
Do a quick pass over the IR, and return types that are candidates for redundant load elimination. |
|
String |
getName()
|
|
(package private) static void |
replaceDefs(IR ir,
LoadElimination.UseRecordSet UseRepSet,
HashMap<LoadElimination.UseRecord,Register> registers)
Perform scalar replacement actions for a Def of a heap variable. |
|
(package private) static LoadElimination.UseRecordSet |
replaceLoads(IR ir,
DF_Solution available,
HashMap<LoadElimination.UseRecord,Register> registers)
Walk over each instruction. |
|
(package private) static void |
replaceLoadWithMove(Register r,
Instruction load)
Replace a Load instruction s with a load from a scalar register r TODO: factor this functionality out elsewhere |
|
boolean |
shouldPerform(OptOptions options)
Determine, possibly by consulting the passed options object, if this optimization plan element should be performed. |
Methods inherited from class org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement |
---|
compose, elapsedTime, initializeForMeasureCompilation, perform, printingEnabled, reportStats |
Methods inherited from class org.jikesrvm.compilers.opt.driver.OptimizationPlanElement |
---|
prettyPrintTime |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final boolean DEBUG
private final int round
Constructor Detail |
---|
public LoadElimination(int round)
round
- which round of load elimination is this?Method Detail |
---|
public boolean shouldPerform(OptOptions options)
OptimizationPlanElement
shouldPerform
in class OptimizationPlanCompositeElement
options
- The Options object for the current compilation.
true
if the plan element should be performed.public String getName()
getName
in class OptimizationPlanCompositeElement
static boolean eliminateLoads(IR ir, DF_Solution available)
static LoadElimination.UseRecordSet replaceLoads(IR ir, DF_Solution available, HashMap<LoadElimination.UseRecord,Register> registers)
POSTCONDITION: sets up the mapping 'registers' from value number to temporary register
ir
- the IRavailable
- information on which values are availableregisters
- a place to store information about temp registersstatic void replaceLoadWithMove(Register r, Instruction load)
TODO: factor this functionality out elsewhere
static void replaceDefs(IR ir, LoadElimination.UseRecordSet UseRepSet, HashMap<LoadElimination.UseRecord,Register> registers)
NOTE: Even loads can def a heap variable.
UseRepSet
- stores the uses(loads) that have been eliminatedregisters
- mapping from valueNumber -> temporary registerstatic void appendMove(Register r, Operand src, Instruction store)
static Register findOrCreateRegister(Object heapType, int valueNumber, HashMap<LoadElimination.UseRecord,Register> registers, ArchitectureSpecificOpt.RegisterPool pool, TypeReference type)
heapType
- a TypeReference or RVMField identifying the array SSA
heap typevalueNumber
- registers
- a mapping from value number to temporary registerpool
- register pool to allocate new temporaries fromtype
- the type to store in the new registerstatic Register findOrCreateRegister(Object heapType, int v1, int v2, HashMap<LoadElimination.UseRecord,Register> registers, ArchitectureSpecificOpt.RegisterPool pool, TypeReference type)
heapType
- a TypeReference identifying the array SSA
heap typev1
- first value numberv2
- second value numberregisters
- a mapping from value number to temporary registerpool
- register pool to allocate new temporaries fromtype
- the type to store in the new registerprivate static <T> HashSet<T> findOrCreateIndexSet(HashMap<Object,HashSet<T>> map, Object key)
map
- a mapping from key to HashSetkey
- a key into the map
public static HashSet<Object> getCandidates(IR ir)
Algorithm: return those types T where
The result contains objects of type RVMField and TypeReference, whose narrowest common ancestor is Object.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |