changeset 15933:0fdfff835128

LSRA: add Interval.getIntervalCoveringOpId(int).
author Josef Eisl <josef.eisl@jku.at>
date Mon, 26 May 2014 15:44:57 +0200
parents 01e6f7caa9b7
children c73fad48e90d
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java
diffstat 1 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java	Mon May 26 15:12:14 2014 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java	Mon May 26 15:44:57 2014 +0200
@@ -883,6 +883,32 @@
         return true;
     }
 
+    // returns the interval that covers the given opId or null if there is none
+    Interval getIntervalCoveringOpId(int opId) {
+        assert opId >= 0 : "invalid opId";
+        assert opId < to() : "can only look into the past";
+
+        if (opId >= from()) {
+            return this;
+        }
+
+        Interval parent = splitParent();
+        Interval result = null;
+
+        assert !parent.splitChildren.isEmpty() : "no split children available";
+        int len = parent.splitChildren.size();
+
+        for (int i = len - 1; i >= 0; i--) {
+            Interval cur = parent.splitChildren.get(i);
+            if (cur.from() <= opId && opId < cur.to()) {
+                assert result == null : "covered by multiple split children " + result + " and " + cur;
+                result = cur;
+            }
+        }
+
+        return result;
+    }
+
     // returns the last split child that ends before the given opId
     Interval getSplitChildBeforeOpId(int opId) {
         assert opId >= 0 : "invalid opId";