public class LinearScanLifetimeAnalysisPhase extends AllocationPhase
AllocationPhase.AllocationContext
LIRPhase.Options
Modifier and Type | Field and Description |
---|---|
protected LinearScan |
allocator |
private BitMap2D |
intervalInLoop
Bit set for each variable that is contained in each loop.
|
Modifier | Constructor and Description |
---|---|
protected |
LinearScanLifetimeAnalysisPhase(LinearScan linearScan) |
Modifier and Type | Method and Description |
---|---|
protected void |
addDef(AllocatableValue operand,
LIRInstruction op,
Interval.RegisterPriority registerPriority,
LIRKind kind) |
protected void |
addRegisterHint(LIRInstruction op,
Value targetValue,
LIRInstruction.OperandMode mode,
EnumSet<LIRInstruction.OperandFlag> flags,
boolean hintAtDef) |
protected void |
addTemp(AllocatableValue operand,
int tempPos,
Interval.RegisterPriority registerPriority,
LIRKind kind) |
protected void |
addUse(AllocatableValue operand,
int from,
int to,
Interval.RegisterPriority registerPriority,
LIRKind kind) |
protected void |
buildIntervals() |
protected void |
changeSpillDefinitionPos(LIRInstruction op,
AllocatableValue operand,
Interval interval,
int defPos)
Eliminates moves from register to stack if the stack slot is known to be correct.
|
protected void |
computeGlobalLiveSets()
Performs a backward dataflow analysis to compute global live sets (i.e.
|
(package private) void |
computeLocalLiveSets()
Computes local live sets (i.e.
|
protected static JavaConstant |
getMaterializedValue(LIRInstruction op,
Value operand,
Interval interval)
Returns a value for a interval definition, which can be used for re-materialization.
|
protected void |
handleMethodArguments(LIRInstruction op)
Optimizes moves related to incoming stack based arguments.
|
(package private) boolean |
isIntervalInLoop(int interval,
int loop) |
protected void |
numberInstructions()
Numbers all instructions in all blocks.
|
private static boolean |
optimizeMethodArgument(Value value) |
protected static Interval.RegisterPriority |
registerPriorityOfInputOperand(EnumSet<LIRInstruction.OperandFlag> flags)
Determines the priority which with an instruction's input operand will be allocated a
register.
|
protected Interval.RegisterPriority |
registerPriorityOfOutputOperand(LIRInstruction op)
Determines the register priority for an instruction's output/result operand.
|
protected void |
reportFailure(int numBlocks) |
protected <B extends AbstractBlockBase<B>> |
run(TargetDescription target,
LIRGenerationResult lirGenRes,
List<B> codeEmittingOrder,
List<B> linearScanOrder,
LIRGeneratorTool.SpillMoveFactory spillMoveFactory,
RegisterAllocationConfig registerAllocationConfig) |
private void |
verifyInput(AbstractBlockBase<?> block,
BitSet liveKill,
Value operand) |
protected void |
verifyLiveness() |
private void |
verifyTemp(BitSet liveKill,
Value operand) |
run
apply, apply, createName, getName
protected final LinearScan allocator
private BitMap2D intervalInLoop
protected LinearScanLifetimeAnalysisPhase(LinearScan linearScan)
linearScan
- protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, LIRGeneratorTool.SpillMoveFactory spillMoveFactory, RegisterAllocationConfig registerAllocationConfig)
run
in class AllocationPhase
boolean isIntervalInLoop(int interval, int loop)
protected void numberInstructions()
void computeLocalLiveSets()
LinearScan.BlockData.liveGen
and LinearScan.BlockData.liveKill
)
separately for each block.private void verifyTemp(BitSet liveKill, Value operand)
private void verifyInput(AbstractBlockBase<?> block, BitSet liveKill, Value operand)
protected void computeGlobalLiveSets()
LinearScan.BlockData.liveIn
and LinearScan.BlockData.liveOut
) for each block.protected void reportFailure(int numBlocks)
protected void verifyLiveness()
protected void addUse(AllocatableValue operand, int from, int to, Interval.RegisterPriority registerPriority, LIRKind kind)
protected void addTemp(AllocatableValue operand, int tempPos, Interval.RegisterPriority registerPriority, LIRKind kind)
protected void addDef(AllocatableValue operand, LIRInstruction op, Interval.RegisterPriority registerPriority, LIRKind kind)
protected void handleMethodArguments(LIRInstruction op)
protected void addRegisterHint(LIRInstruction op, Value targetValue, LIRInstruction.OperandMode mode, EnumSet<LIRInstruction.OperandFlag> flags, boolean hintAtDef)
protected void changeSpillDefinitionPos(LIRInstruction op, AllocatableValue operand, Interval interval, int defPos)
op
- operand
- private static boolean optimizeMethodArgument(Value value)
protected Interval.RegisterPriority registerPriorityOfOutputOperand(LIRInstruction op)
protected static Interval.RegisterPriority registerPriorityOfInputOperand(EnumSet<LIRInstruction.OperandFlag> flags)
protected void buildIntervals()
protected static JavaConstant getMaterializedValue(LIRInstruction op, Value operand, Interval interval)
op
- An instruction which defines a valueoperand
- The destination operand of the instructioninterval
- The interval for this defined value.JavaConstant
.