Search in sources :

Example 1 with EstimateBlockFrequencies

use of org.jikesrvm.compilers.opt.controlflow.EstimateBlockFrequencies in project JikesRVM by JikesRVM.

the class OptimizationPlanner method LIROptimizations.

/**
 * This method defines the optimization plan elements that
 * are to be performed on the LIR.
 *
 * @param p the plan under construction
 */
private static void LIROptimizations(ArrayList<OptimizationPlanElement> p) {
    // SSA meta-phase
    SSAinLIR(p);
    // Perform local copy propagation for a factored basic block.
    addComponent(p, new LocalCopyProp());
    // Perform local constant propagation for a factored basic block.
    addComponent(p, new LocalConstantProp());
    // Perform local common-subexpression elimination for a factored basic block.
    addComponent(p, new LocalCSE(false));
    // Simple flow-insensitive optimizations
    addComponent(p, new Simple(0, false, false, false, VM.BuildForIA32));
    // Use the LST to estimate basic block frequency
    addComponent(p, new OptimizationPlanCompositeElement("Basic Block Frequency Estimation", new Object[] { new BuildLST(), new EstimateBlockFrequencies() }));
    // Perform basic block reordering
    addComponent(p, new ReorderingPhase());
    // Perform peephole branch optimizations
    addComponent(p, new BranchOptimizations(0, false, true));
    if (VM.BuildForAdaptiveSystem) {
        // Arnold & Ryder instrumentation sampling framework
        addComponent(p, new InstrumentationSamplingFramework());
        // Convert high level place holder instructions into actual instrumentation
        addComponent(p, new LowerInstrumentation());
    }
}
Also used : LowerInstrumentation(org.jikesrvm.adaptive.recompilation.instrumentation.LowerInstrumentation) LocalCopyProp(org.jikesrvm.compilers.opt.LocalCopyProp) ReorderingPhase(org.jikesrvm.compilers.opt.controlflow.ReorderingPhase) EstimateBlockFrequencies(org.jikesrvm.compilers.opt.controlflow.EstimateBlockFrequencies) BuildLST(org.jikesrvm.compilers.opt.controlflow.BuildLST) LocalConstantProp(org.jikesrvm.compilers.opt.LocalConstantProp) InstrumentationSamplingFramework(org.jikesrvm.adaptive.recompilation.instrumentation.InstrumentationSamplingFramework) LocalCSE(org.jikesrvm.compilers.opt.LocalCSE) Simple(org.jikesrvm.compilers.opt.Simple) BranchOptimizations(org.jikesrvm.compilers.opt.controlflow.BranchOptimizations)

Example 2 with EstimateBlockFrequencies

use of org.jikesrvm.compilers.opt.controlflow.EstimateBlockFrequencies in project JikesRVM by JikesRVM.

the class OptimizationPlanner method HIROptimizations.

/**
 * This method defines the optimization plan elements that
 * are to be performed on the HIR.
 *
 * @param p the plan under construction
 */
private static void HIROptimizations(ArrayList<OptimizationPlanElement> p) {
    // Various large-scale CFG transformations.
    // Do these very early in the pipe so that all HIR opts can benefit.
    composeComponents(p, "CFG Transformations", new Object[] { // tail recursion elimination
    new TailRecursionElimination(), // Assumption: none of these are active at O0.
    new OptimizationPlanCompositeElement("Basic Block Frequency Estimation", new Object[] { new BuildLST(), new EstimateBlockFrequencies() }) {

        @Override
        public boolean shouldPerform(OptOptions options) {
            return options.getOptLevel() >= 1;
        }
    }, // CFG splitting
    new StaticSplitting(), // restructure loops
    new CFGTransformations(), // Loop unrolling
    new LoopUnrolling(), new BranchOptimizations(1, true, true) });
    // Use the LST to insert yieldpoints and estimate
    // basic block frequency from branch probabilities
    composeComponents(p, "CFG Structural Analysis", new Object[] { new BuildLST(), new YieldPoints(), new EstimateBlockFrequencies() });
    // Simple flow-insensitive optimizations
    addComponent(p, new Simple(1, true, true, false, false));
    // Simple escape analysis and related transformations
    addComponent(p, new EscapeTransformations());
    // Perform peephole branch optimizations to clean-up before SSA stuff
    addComponent(p, new BranchOptimizations(1, true, true));
    // SSA meta-phase
    SSAinHIR(p);
    // Perform local copy propagation for a factored basic block.
    addComponent(p, new LocalCopyProp());
    // Perform local constant propagation for a factored basic block.
    addComponent(p, new LocalConstantProp());
    // Perform local common-subexpression elimination for a
    // factored basic block.
    addComponent(p, new LocalCSE(true));
    // Flow-insensitive field analysis
    addComponent(p, new FieldAnalysis());
    if (VM.BuildForAdaptiveSystem) {
        // Insert counter on each method prologue
        // Insert yieldpoint counters
        addComponent(p, new InsertYieldpointCounters());
        // Insert counter on each HIR instruction
        addComponent(p, new InsertInstructionCounters());
        // Insert method invocation counters
        addComponent(p, new InsertMethodInvocationCounter());
    }
}
Also used : CFGTransformations(org.jikesrvm.compilers.opt.controlflow.CFGTransformations) LocalCopyProp(org.jikesrvm.compilers.opt.LocalCopyProp) EstimateBlockFrequencies(org.jikesrvm.compilers.opt.controlflow.EstimateBlockFrequencies) InsertMethodInvocationCounter(org.jikesrvm.adaptive.recompilation.instrumentation.InsertMethodInvocationCounter) OptOptions(org.jikesrvm.compilers.opt.OptOptions) BuildLST(org.jikesrvm.compilers.opt.controlflow.BuildLST) EscapeTransformations(org.jikesrvm.compilers.opt.escape.EscapeTransformations) LoopUnrolling(org.jikesrvm.compilers.opt.controlflow.LoopUnrolling) StaticSplitting(org.jikesrvm.compilers.opt.controlflow.StaticSplitting) Simple(org.jikesrvm.compilers.opt.Simple) LocalCSE(org.jikesrvm.compilers.opt.LocalCSE) InsertYieldpointCounters(org.jikesrvm.adaptive.recompilation.instrumentation.InsertYieldpointCounters) YieldPoints(org.jikesrvm.compilers.opt.controlflow.YieldPoints) FieldAnalysis(org.jikesrvm.compilers.opt.FieldAnalysis) TailRecursionElimination(org.jikesrvm.compilers.opt.controlflow.TailRecursionElimination) LocalConstantProp(org.jikesrvm.compilers.opt.LocalConstantProp) InsertInstructionCounters(org.jikesrvm.adaptive.recompilation.instrumentation.InsertInstructionCounters) BranchOptimizations(org.jikesrvm.compilers.opt.controlflow.BranchOptimizations)

Aggregations

LocalCSE (org.jikesrvm.compilers.opt.LocalCSE)2 LocalConstantProp (org.jikesrvm.compilers.opt.LocalConstantProp)2 LocalCopyProp (org.jikesrvm.compilers.opt.LocalCopyProp)2 Simple (org.jikesrvm.compilers.opt.Simple)2 BranchOptimizations (org.jikesrvm.compilers.opt.controlflow.BranchOptimizations)2 BuildLST (org.jikesrvm.compilers.opt.controlflow.BuildLST)2 EstimateBlockFrequencies (org.jikesrvm.compilers.opt.controlflow.EstimateBlockFrequencies)2 InsertInstructionCounters (org.jikesrvm.adaptive.recompilation.instrumentation.InsertInstructionCounters)1 InsertMethodInvocationCounter (org.jikesrvm.adaptive.recompilation.instrumentation.InsertMethodInvocationCounter)1 InsertYieldpointCounters (org.jikesrvm.adaptive.recompilation.instrumentation.InsertYieldpointCounters)1 InstrumentationSamplingFramework (org.jikesrvm.adaptive.recompilation.instrumentation.InstrumentationSamplingFramework)1 LowerInstrumentation (org.jikesrvm.adaptive.recompilation.instrumentation.LowerInstrumentation)1 FieldAnalysis (org.jikesrvm.compilers.opt.FieldAnalysis)1 OptOptions (org.jikesrvm.compilers.opt.OptOptions)1 CFGTransformations (org.jikesrvm.compilers.opt.controlflow.CFGTransformations)1 LoopUnrolling (org.jikesrvm.compilers.opt.controlflow.LoopUnrolling)1 ReorderingPhase (org.jikesrvm.compilers.opt.controlflow.ReorderingPhase)1 StaticSplitting (org.jikesrvm.compilers.opt.controlflow.StaticSplitting)1 TailRecursionElimination (org.jikesrvm.compilers.opt.controlflow.TailRecursionElimination)1 YieldPoints (org.jikesrvm.compilers.opt.controlflow.YieldPoints)1