public final class EdgeMoveOptimizer extends PostAllocationOptimizationPhase
When a block has more than one predecessor, and all predecessors end with the same sequence of move instructions, then these sequences can be replaced with a single copy of the sequence at the beginning of the block.
Similarly, when a block has more than one successor, then same sequences of moves at the beginning of the successors can be placed once at the end of the block. But because the moves must be inserted before all branch instructions, this works only when there is exactly one conditional branch at the end of the block (because the moves must be inserted before all branches, but after all compares).
This optimization affects all kind of moves (reg->reg, reg->stack and stack->reg). Because this optimization works best when a block contains only a few moves, it has a huge impact on the number of blocks that are totally empty.
Modifier and Type | Class and Description |
---|---|
private static class |
EdgeMoveOptimizer.Optimizer |
PostAllocationOptimizationPhase.PostAllocationOptimizationContext
LIRPhase.Options
Constructor and Description |
---|
EdgeMoveOptimizer() |
Modifier and Type | Method and Description |
---|---|
protected <B extends AbstractBlockBase<B>> |
run(TargetDescription target,
LIRGenerationResult lirGenRes,
List<B> codeEmittingOrder,
List<B> linearScanOrder,
BenchmarkCounterFactory counterFactory) |
run
apply, apply, createName, getName
public EdgeMoveOptimizer()
protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, BenchmarkCounterFactory counterFactory)
run
in class PostAllocationOptimizationPhase