# HG changeset patch # User Lukas Stadler # Date 1329745052 -3600 # Node ID 8e39bd349bbbaec5b7d0427069951d540eda0d7a # Parent 5195b780d253802c141a7b9289b218109b12cfdd added Condition.implies(...) diff -r 5195b780d253 -r 8e39bd349bbb graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/Condition.java --- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/Condition.java Mon Feb 20 14:34:51 2012 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/Condition.java Mon Feb 20 14:37:32 2012 +0100 @@ -134,6 +134,27 @@ throw new IllegalArgumentException(this.toString()); } + public boolean implies(Condition other) { + if (other == this) { + return true; + } + switch (this) { + case EQ: return other == LE || other == GE || other == BE || other == AE; + case NE: return false; + case LT: return other == LE; + case LE: return false; + case GT: return other == GE; + case GE: return false; + case BT: return other == BE; + case BE: return false; + case AT: return other == AE; + case AE: return false; + case OF: return false; + case NOF: return false; + } + throw new IllegalArgumentException(this.toString()); + } + /** * Mirror this conditional (i.e. commute "a op b" to "b op' a") * @return the condition representing the equivalent commuted operation