Mercurial > hg > graal-jvmci-8
changeset 19202:0cd7d78a29c5
GraalCompiler: outsource low-level compiler pipeline.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Fri, 06 Feb 2015 17:53:14 +0100 |
parents | 12508cf94ad9 |
children | fb461d6fb50c |
files | graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java |
diffstat | 1 files changed, 47 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Fri Feb 06 17:04:48 2015 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Fri Feb 06 17:53:14 2015 +0100 @@ -336,60 +336,67 @@ throw Debug.handle(e); } - try (Scope s0 = Debug.scope("HighTier")) { - if (ConstantLoadOptimization.Options.ConstantLoadOptimization.getValue()) { - try (Scope s = Debug.scope("ConstantLoadOptimization", lir)) { - ConstantLoadOptimization.optimize(lirGenRes.getLIR(), lirGen); - Debug.dump(lir, "After constant load optimization"); - } catch (Throwable e) { - throw Debug.handle(e); - } - } + try (Scope s = Debug.scope("LowLevelTier", nodeLirGen)) { + return emitLowLevel(backend, target, lir, codeEmittingOrder, linearScanOrder, lirGenRes, lirGen); + } catch (Throwable e) { + throw Debug.handle(e); } + } catch (Throwable e) { + throw Debug.handle(e); + } + } - try (Scope s0 = Debug.scope("MidTier")) { - try (Scope s = Debug.scope("Allocator", nodeLirGen)) { - if (backend.shouldAllocateRegisters()) { - LinearScan.allocate(target, lirGenRes); - } + public static <T extends AbstractBlock<T>> LIRGenerationResult emitLowLevel(Backend backend, TargetDescription target, LIR lir, List<T> codeEmittingOrder, + @SuppressWarnings("unused") List<T> linearScanOrder, LIRGenerationResult lirGenRes, LIRGeneratorTool lirGen) { + try (Scope s0 = Debug.scope("HighTier")) { + if (ConstantLoadOptimization.Options.ConstantLoadOptimization.getValue()) { + try (Scope s = Debug.scope("ConstantLoadOptimization", lir)) { + ConstantLoadOptimization.optimize(lirGenRes.getLIR(), lirGen); + Debug.dump(lir, "After constant load optimization"); } catch (Throwable e) { throw Debug.handle(e); } + } + } - try (Scope s1 = Debug.scope("BuildFrameMap")) { - // build frame map - final StackSlotAllocator allocator; - if (LSStackSlotAllocator.Options.LSStackSlotAllocation.getValue()) { - allocator = new LSStackSlotAllocator(); - } else { - allocator = new SimpleStackSlotAllocator(); - } - lirGenRes.buildFrameMap(allocator); - Debug.dump(lir, "After FrameMap building"); - } - try (Scope s1 = Debug.scope("MarkLocations")) { - if (backend.shouldAllocateRegisters()) { - // currently we mark locations only if we do register allocation - LocationMarker.markLocations(lirGenRes); - } + try (Scope s0 = Debug.scope("MidTier")) { + try (Scope s = Debug.scope("Allocator")) { + if (backend.shouldAllocateRegisters()) { + LinearScan.allocate(target, lirGenRes); } } - try (Scope s = Debug.scope("LowTier")) { - EdgeMoveOptimizer.optimize(lirGenRes); - ControlFlowOptimizer.optimize(lir, codeEmittingOrder); - if (lirGen.canEliminateRedundantMoves()) { - RedundantMoveElimination.optimize(lirGenRes); + try (Scope s1 = Debug.scope("BuildFrameMap")) { + // build frame map + final StackSlotAllocator allocator; + if (LSStackSlotAllocator.Options.LSStackSlotAllocation.getValue()) { + allocator = new LSStackSlotAllocator(); + } else { + allocator = new SimpleStackSlotAllocator(); } - NullCheckOptimizer.optimize(target, lirGenRes); + lirGenRes.buildFrameMap(allocator); + Debug.dump(lir, "After FrameMap building"); + } + try (Scope s1 = Debug.scope("MarkLocations")) { + if (backend.shouldAllocateRegisters()) { + // currently we mark locations only if we do register allocation + LocationMarker.markLocations(lirGenRes); + } + } + } - Debug.dump(lir, "After control flow optimization"); + try (Scope s = Debug.scope("LowTier")) { + EdgeMoveOptimizer.optimize(lirGenRes); + ControlFlowOptimizer.optimize(lir, codeEmittingOrder); + if (lirGen.canEliminateRedundantMoves()) { + RedundantMoveElimination.optimize(lirGenRes); } + NullCheckOptimizer.optimize(target, lirGenRes); - return lirGenRes; - } catch (Throwable e) { - throw Debug.handle(e); + Debug.dump(lir, "After control flow optimization"); } + + return lirGenRes; } public static void emitCode(Backend backend, Assumptions assumptions, LIRGenerationResult lirGenRes, CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner,