changeset 19216:baa9fb17fd91

Make LSStackSlotAllocator and SimpleStackSlotAllocator a LowLevelMidTierPhase.
author Josef Eisl <josef.eisl@jku.at>
date Mon, 09 Feb 2015 09:41:42 +0100
parents 5dbf7f918d94
children 1f2a7647c8e9
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/SimpleStackSlotAllocator.java
diffstat 3 files changed, 19 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Mon Feb 09 09:25:16 2015 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Mon Feb 09 09:41:42 2015 +0100
@@ -371,13 +371,11 @@
 
             try (Scope s1 = Debug.scope("BuildFrameMap")) {
                 // build frame map
-                final StackSlotAllocator allocator;
                 if (LSStackSlotAllocator.Options.LSStackSlotAllocation.getValue()) {
-                    allocator = new LSStackSlotAllocator();
+                    new LSStackSlotAllocator<T>().apply(target, lirGenRes, c);
                 } else {
-                    allocator = new SimpleStackSlotAllocator();
+                    new SimpleStackSlotAllocator<T>().apply(target, lirGenRes, c);
                 }
-                lirGenRes.buildFrameMap(allocator);
                 Debug.dump(lir, "After FrameMap building");
             }
             try (Scope s1 = Debug.scope("MarkLocations")) {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java	Mon Feb 09 09:25:16 2015 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java	Mon Feb 09 09:41:42 2015 +0100
@@ -38,6 +38,7 @@
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.lir.gen.*;
+import com.oracle.graal.lir.phases.*;
 import com.oracle.graal.options.*;
 
 /**
@@ -50,7 +51,7 @@
  * {@link OperandFlag#UNINITIALIZED}. Otherwise the stack slot might be reused and its content
  * destroyed.
  */
-public final class LSStackSlotAllocator implements StackSlotAllocator {
+public final class LSStackSlotAllocator<B extends AbstractBlock<B>> extends LowLevelMidTierPhase<B> implements StackSlotAllocator {
 
     public static class Options {
         // @formatter:off
@@ -66,6 +67,11 @@
     private static final DebugTimer AllocateSlotsTimer = Debug.timer("LSStackSlotAllocator[AllocateSlots]");
     private static final DebugTimer AssignSlotsTimer = Debug.timer("LSStackSlotAllocator[AssignSlots]");
 
+    @Override
+    protected void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder) {
+        lirGenRes.buildFrameMap(this);
+    }
+
     public void allocateStackSlots(FrameMapBuilderTool builder, LIRGenerationResult res) {
         try (TimerCloseable t = MainTimer.start()) {
             new Allocator(res.getLIR(), builder).allocate();
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/SimpleStackSlotAllocator.java	Mon Feb 09 09:25:16 2015 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/SimpleStackSlotAllocator.java	Mon Feb 09 09:41:42 2015 +0100
@@ -24,16 +24,24 @@
 
 import static com.oracle.graal.api.code.ValueUtil.*;
 
+import java.util.*;
+
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.*;
+import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.lir.gen.*;
+import com.oracle.graal.lir.phases.*;
 
-public class SimpleStackSlotAllocator implements StackSlotAllocator {
+public class SimpleStackSlotAllocator<B extends AbstractBlock<B>> extends LowLevelMidTierPhase<B> implements StackSlotAllocator {
+
+    @Override
+    protected void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder) {
+        lirGenRes.buildFrameMap(this);
+    }
 
     public void allocateStackSlots(FrameMapBuilderTool builder, LIRGenerationResult res) {
         StackSlot[] mapping = new StackSlot[builder.getNumberOfStackSlots()];