< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/type/ArithmeticOpTable.java
Print this page
@@ -94,10 +94,26 @@
} else {
return EMPTY;
}
}
+ public BinaryOp<?>[] getBinaryOps() {
+ return new BinaryOp<?>[]{add, sub, mul, mulHigh, umulHigh, div, rem, and, or, xor};
+ }
+
+ public UnaryOp<?>[] getUnaryOps() {
+ return new UnaryOp<?>[]{neg, not, abs, sqrt};
+ }
+
+ public ShiftOp<?>[] getShiftOps() {
+ return new ShiftOp<?>[]{shl, shr, ushr};
+ }
+
+ public IntegerConvertOp<?>[] getIntegerConvertOps() {
+ return new IntegerConvertOp<?>[]{zeroExtend, signExtend, narrow};
+ }
+
public static final ArithmeticOpTable EMPTY = new ArithmeticOpTable(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
public interface ArithmeticOpWrapper {
<OP> UnaryOp<OP> wrapUnaryOp(UnaryOp<OP> op);
@@ -560,11 +576,14 @@
this.associative = associative;
this.commutative = commutative;
}
/**
- * Apply the operation to two {@linkplain Constant Constants}.
+ * Applies this operation to {@code a} and {@code b}.
+ *
+ * @return the result of applying this operation or {@code null} if applying it would raise
+ * an exception (e.g., {@link ArithmeticException} for dividing by 0)
*/
public abstract Constant foldConstant(Constant a, Constant b);
/**
* Apply the operation to two {@linkplain Stamp Stamps}.
< prev index next >