changeset 22529:5b0239e1d562

TraceRA: only blocks with LabelOp and JumpOp are trivial.
author Josef Eisl <josef.eisl@jku.at>
date Fri, 28 Aug 2015 14:32:42 +0200
parents b1d4fd32135f
children 6ba6a4aef241
files graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/TraceRegisterAllocationPhase.java
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/TraceRegisterAllocationPhase.java	Fri Aug 28 13:46:09 2015 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/trace/TraceRegisterAllocationPhase.java	Fri Aug 28 14:32:42 2015 +0200
@@ -36,7 +36,7 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.*;
-import com.oracle.graal.lir.StandardOp.ValueMoveOp;
+import com.oracle.graal.lir.StandardOp.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
 import com.oracle.graal.lir.phases.*;
@@ -116,7 +116,19 @@
     }
 
     static boolean isTrivialTrace(LIR lir, List<? extends AbstractBlockBase<?>> trace) {
-        return trace.size() == 1 && lir.getLIRforBlock(trace.iterator().next()).size() == 2;
+        if (trace.size() != 1) {
+            return false;
+        }
+        List<LIRInstruction> instructions = lir.getLIRforBlock(trace.iterator().next());
+        if (instructions.size() != 2) {
+            return false;
+        }
+        assert instructions.get(0) instanceof LabelOp : "First instruction not a LabelOp: " + instructions.get(0);
+        /*
+         * Now we need to check if the BlockEndOp has no special operand requirements (i.e.
+         * stack-slot, register). For now we just check for JumpOp because we know that it doesn't.
+         */
+        return instructions.get(1) instanceof JumpOp;
     }
 
     /**