changeset 19201:12508cf94ad9

GraalCompiler.emitLIR(): scopes for HighTier, MidTier, LowTier.
author Josef Eisl <josef.eisl@jku.at>
date Fri, 06 Feb 2015 17:04:48 +0100
parents 7f827cc5e4f7
children 0cd7d78a29c5
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java
diffstat 1 files changed, 32 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Fri Feb 06 16:57:37 2015 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Fri Feb 06 17:04:48 2015 +0100
@@ -336,42 +336,46 @@
                 throw Debug.handle(e);
             }
 
-            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 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("Allocator", nodeLirGen)) {
-                if (backend.shouldAllocateRegisters()) {
-                    LinearScan.allocate(target, lirGenRes);
+            try (Scope s0 = Debug.scope("MidTier")) {
+                try (Scope s = Debug.scope("Allocator", nodeLirGen)) {
+                    if (backend.shouldAllocateRegisters()) {
+                        LinearScan.allocate(target, lirGenRes);
+                    }
+                } catch (Throwable e) {
+                    throw Debug.handle(e);
                 }
-            } 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();
+                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");
                 }
-                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 s1 = Debug.scope("MarkLocations")) {
+                    if (backend.shouldAllocateRegisters()) {
+                        // currently we mark locations only if we do register allocation
+                        LocationMarker.markLocations(lirGenRes);
+                    }
                 }
             }
 
-            try (Scope s = Debug.scope("ControlFlowOptimizations")) {
+            try (Scope s = Debug.scope("LowTier")) {
                 EdgeMoveOptimizer.optimize(lirGenRes);
                 ControlFlowOptimizer.optimize(lir, codeEmittingOrder);
                 if (lirGen.canEliminateRedundantMoves()) {
@@ -380,9 +384,8 @@
                 NullCheckOptimizer.optimize(target, lirGenRes);
 
                 Debug.dump(lir, "After control flow optimization");
-            } catch (Throwable e) {
-                throw Debug.handle(e);
             }
+
             return lirGenRes;
         } catch (Throwable e) {
             throw Debug.handle(e);