# HG changeset patch # User Josef Eisl # Date 1401111897 -7200 # Node ID 0fdfff83512872d1ca11b2537576e7fffecba419 # Parent 01e6f7caa9b7e9c99d01a3e35e9d31223ab2d233 LSRA: add Interval.getIntervalCoveringOpId(int). diff -r 01e6f7caa9b7 -r 0fdfff835128 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java --- 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";