Search in sources :

Example 6 with IR

use of org.jikesrvm.compilers.opt.ir.IR in project JikesRVM by JikesRVM.

the class CompilationPlan method execute.

/**
 * Execute a compilation plan by executing each element
 * in the optimization plan.
 *
 * @return the IR created by the execution of the optimization plan
 */
public IR execute() {
    IR ir = new IR(method, this);
    // If there is instrumentation to perform, do some initialization
    if (instrumentationPlan != null) {
        instrumentationPlan.initInstrumentation(method);
    }
    for (OptimizationPlanElement element : optimizationPlan) {
        ir.setIdForNextPhase();
        element.perform(ir);
    }
    // whether this matters.
    if (instrumentationPlan != null) {
        instrumentationPlan.finalizeInstrumentation(method);
    }
    return ir;
}
Also used : IR(org.jikesrvm.compilers.opt.ir.IR)

Example 7 with IR

use of org.jikesrvm.compilers.opt.ir.IR in project JikesRVM by JikesRVM.

the class TailRecursionEliminationTest method doesNotThrowExceptionsOnCFGWithoutInstructions.

@Test
public void doesNotThrowExceptionsOnCFGWithoutInstructions() {
    OptOptions opts = new OptOptions();
    IR ir = new IR(null, null, opts);
    opts.setOptLevel(1);
    TestingTools.addEmptyCFGToIR(ir);
    tailRecursionElimination.perform(ir);
}
Also used : IR(org.jikesrvm.compilers.opt.ir.IR) OptOptions(org.jikesrvm.compilers.opt.OptOptions) Test(org.junit.Test)

Example 8 with IR

use of org.jikesrvm.compilers.opt.ir.IR in project JikesRVM by JikesRVM.

the class SplitBasicBlockTest method doesNotSplitEmptyCFG.

@Test
public void doesNotSplitEmptyCFG() {
    int maxInstPerBlock = 1;
    IR ir = createIRWithEmptyCFG(maxInstPerBlock);
    int nodeNumberBefore = ir.cfg.numberOfNodes();
    splitPhase.perform(ir);
    int nodeNumberAfter = ir.cfg.numberOfNodes();
    assertThat(nodeNumberAfter, is(nodeNumberBefore));
}
Also used : IR(org.jikesrvm.compilers.opt.ir.IR) Test(org.junit.Test)

Example 9 with IR

use of org.jikesrvm.compilers.opt.ir.IR in project JikesRVM by JikesRVM.

the class SplitBasicBlockTest method splitsAllBlocksThatHaveTooManyInstructions.

@Test
public void splitsAllBlocksThatHaveTooManyInstructions() {
    int maxInstPerBlock = 2;
    IR ir = createIRWithEmptyCFG(maxInstPerBlock);
    addNumberOfInstructionsToBlock(ir, 13);
    splitPhase.perform(ir);
    assertThatInstructionCountForEachBlockIsAtMost(ir, maxInstPerBlock);
}
Also used : IR(org.jikesrvm.compilers.opt.ir.IR) Test(org.junit.Test)

Example 10 with IR

use of org.jikesrvm.compilers.opt.ir.IR in project JikesRVM by JikesRVM.

the class SplitBasicBlockTest method createIRWithEmptyCFG.

private IR createIRWithEmptyCFG(int maxInstPerBlock) {
    OptOptions opts = new OptOptions();
    IR ir = new IR(null, null, opts);
    opts.L2M_MAX_BLOCK_SIZE = maxInstPerBlock;
    TestingTools.addEmptyCFGToIR(ir);
    return ir;
}
Also used : IR(org.jikesrvm.compilers.opt.ir.IR) OptOptions(org.jikesrvm.compilers.opt.OptOptions)

Aggregations

IR (org.jikesrvm.compilers.opt.ir.IR)15 Test (org.junit.Test)10 OptOptions (org.jikesrvm.compilers.opt.OptOptions)5 NormalMethod (org.jikesrvm.classloader.NormalMethod)3 BasicBlock (org.jikesrvm.compilers.opt.ir.BasicBlock)2 MIRInfo (org.jikesrvm.compilers.opt.ir.MIRInfo)2 OptimizingCompilerException (org.jikesrvm.compilers.opt.OptimizingCompilerException)1 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)1 BitVector (org.jikesrvm.util.BitVector)1