001/* 002 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. 008 * 009 * This code is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 011 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 012 * version 2 for more details (a copy is included in the LICENSE file that 013 * accompanied this code). 014 * 015 * You should have received a copy of the GNU General Public License version 016 * 2 along with this work; if not, write to the Free Software Foundation, 017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 018 * 019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 020 * or visit www.oracle.com if you need additional information or have any 021 * questions. 022 */ 023package com.oracle.graal.compiler.common.type; 024 025import static jdk.internal.jvmci.meta.MetaUtil.*; 026 027import java.util.*; 028import java.util.function.*; 029import java.util.stream.*; 030 031import jdk.internal.jvmci.meta.*; 032 033import com.oracle.graal.compiler.common.calc.*; 034import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.Add; 035import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.And; 036import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.Div; 037import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.Mul; 038import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.Or; 039import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.Rem; 040import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.Sub; 041import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.Xor; 042import com.oracle.graal.compiler.common.type.ArithmeticOpTable.IntegerConvertOp.Narrow; 043import com.oracle.graal.compiler.common.type.ArithmeticOpTable.IntegerConvertOp.SignExtend; 044import com.oracle.graal.compiler.common.type.ArithmeticOpTable.IntegerConvertOp.ZeroExtend; 045import com.oracle.graal.compiler.common.type.ArithmeticOpTable.ShiftOp.Shl; 046import com.oracle.graal.compiler.common.type.ArithmeticOpTable.ShiftOp.Shr; 047import com.oracle.graal.compiler.common.type.ArithmeticOpTable.ShiftOp.UShr; 048import com.oracle.graal.compiler.common.type.ArithmeticOpTable.UnaryOp.Abs; 049import com.oracle.graal.compiler.common.type.ArithmeticOpTable.UnaryOp.Neg; 050import com.oracle.graal.compiler.common.type.ArithmeticOpTable.UnaryOp.Not; 051import com.oracle.graal.compiler.common.type.ArithmeticOpTable.UnaryOp.Sqrt; 052 053/** 054 * Information about arithmetic operations. 055 */ 056public final class ArithmeticOpTable { 057 058 private final UnaryOp<Neg> neg; 059 private final BinaryOp<Add> add; 060 private final BinaryOp<Sub> sub; 061 062 private final BinaryOp<Mul> mul; 063 private final BinaryOp<Div> div; 064 private final BinaryOp<Rem> rem; 065 066 private final UnaryOp<Not> not; 067 private final BinaryOp<And> and; 068 private final BinaryOp<Or> or; 069 private final BinaryOp<Xor> xor; 070 071 private final ShiftOp<Shl> shl; 072 private final ShiftOp<Shr> shr; 073 private final ShiftOp<UShr> ushr; 074 075 private final UnaryOp<Abs> abs; 076 private final UnaryOp<Sqrt> sqrt; 077 078 private final IntegerConvertOp<ZeroExtend> zeroExtend; 079 private final IntegerConvertOp<SignExtend> signExtend; 080 private final IntegerConvertOp<Narrow> narrow; 081 082 private final FloatConvertOp[] floatConvert; 083 private final int hash; 084 085 public static ArithmeticOpTable forStamp(Stamp s) { 086 if (s instanceof ArithmeticStamp) { 087 return ((ArithmeticStamp) s).getOps(); 088 } else { 089 return EMPTY; 090 } 091 } 092 093 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); 094 095 public ArithmeticOpTable(UnaryOp<Neg> neg, BinaryOp<Add> add, BinaryOp<Sub> sub, BinaryOp<Mul> mul, BinaryOp<Div> div, BinaryOp<Rem> rem, UnaryOp<Not> not, BinaryOp<And> and, BinaryOp<Or> or, 096 BinaryOp<Xor> xor, ShiftOp<Shl> shl, ShiftOp<Shr> shr, ShiftOp<UShr> ushr, UnaryOp<Abs> abs, UnaryOp<Sqrt> sqrt, IntegerConvertOp<ZeroExtend> zeroExtend, 097 IntegerConvertOp<SignExtend> signExtend, IntegerConvertOp<Narrow> narrow, FloatConvertOp... floatConvert) { 098 this(neg, add, sub, mul, div, rem, not, and, or, xor, shl, shr, ushr, abs, sqrt, zeroExtend, signExtend, narrow, Stream.of(floatConvert)); 099 } 100 101 public interface ArithmeticOpWrapper { 102 103 <OP> UnaryOp<OP> wrapUnaryOp(UnaryOp<OP> op); 104 105 <OP> BinaryOp<OP> wrapBinaryOp(BinaryOp<OP> op); 106 107 <OP> ShiftOp<OP> wrapShiftOp(ShiftOp<OP> op); 108 109 <OP> IntegerConvertOp<OP> wrapIntegerConvertOp(IntegerConvertOp<OP> op); 110 111 FloatConvertOp wrapFloatConvertOp(FloatConvertOp op); 112 } 113 114 private static <T> T wrapIfNonNull(Function<T, T> wrapper, T obj) { 115 if (obj == null) { 116 return null; 117 } else { 118 return wrapper.apply(obj); 119 } 120 } 121 122 public static ArithmeticOpTable wrap(ArithmeticOpWrapper wrapper, ArithmeticOpTable inner) { 123 UnaryOp<Neg> neg = wrapIfNonNull(wrapper::wrapUnaryOp, inner.getNeg()); 124 BinaryOp<Add> add = wrapIfNonNull(wrapper::wrapBinaryOp, inner.getAdd()); 125 BinaryOp<Sub> sub = wrapIfNonNull(wrapper::wrapBinaryOp, inner.getSub()); 126 127 BinaryOp<Mul> mul = wrapIfNonNull(wrapper::wrapBinaryOp, inner.getMul()); 128 BinaryOp<Div> div = wrapIfNonNull(wrapper::wrapBinaryOp, inner.getDiv()); 129 BinaryOp<Rem> rem = wrapIfNonNull(wrapper::wrapBinaryOp, inner.getRem()); 130 131 UnaryOp<Not> not = wrapIfNonNull(wrapper::wrapUnaryOp, inner.getNot()); 132 BinaryOp<And> and = wrapIfNonNull(wrapper::wrapBinaryOp, inner.getAnd()); 133 BinaryOp<Or> or = wrapIfNonNull(wrapper::wrapBinaryOp, inner.getOr()); 134 BinaryOp<Xor> xor = wrapIfNonNull(wrapper::wrapBinaryOp, inner.getXor()); 135 136 ShiftOp<Shl> shl = wrapIfNonNull(wrapper::wrapShiftOp, inner.getShl()); 137 ShiftOp<Shr> shr = wrapIfNonNull(wrapper::wrapShiftOp, inner.getShr()); 138 ShiftOp<UShr> ushr = wrapIfNonNull(wrapper::wrapShiftOp, inner.getUShr()); 139 140 UnaryOp<Abs> abs = wrapIfNonNull(wrapper::wrapUnaryOp, inner.getAbs()); 141 UnaryOp<Sqrt> sqrt = wrapIfNonNull(wrapper::wrapUnaryOp, inner.getSqrt()); 142 143 IntegerConvertOp<ZeroExtend> zeroExtend = wrapIfNonNull(wrapper::wrapIntegerConvertOp, inner.getZeroExtend()); 144 IntegerConvertOp<SignExtend> signExtend = wrapIfNonNull(wrapper::wrapIntegerConvertOp, inner.getSignExtend()); 145 IntegerConvertOp<Narrow> narrow = wrapIfNonNull(wrapper::wrapIntegerConvertOp, inner.getNarrow()); 146 147 Stream<FloatConvertOp> floatConvert = Stream.of(inner.floatConvert).filter(Objects::nonNull).map(wrapper::wrapFloatConvertOp); 148 149 return new ArithmeticOpTable(neg, add, sub, mul, div, rem, not, and, or, xor, shl, shr, ushr, abs, sqrt, zeroExtend, signExtend, narrow, floatConvert); 150 } 151 152 private ArithmeticOpTable(UnaryOp<Neg> neg, BinaryOp<Add> add, BinaryOp<Sub> sub, BinaryOp<Mul> mul, BinaryOp<Div> div, BinaryOp<Rem> rem, UnaryOp<Not> not, BinaryOp<And> and, BinaryOp<Or> or, 153 BinaryOp<Xor> xor, ShiftOp<Shl> shl, ShiftOp<Shr> shr, ShiftOp<UShr> ushr, UnaryOp<Abs> abs, UnaryOp<Sqrt> sqrt, IntegerConvertOp<ZeroExtend> zeroExtend, 154 IntegerConvertOp<SignExtend> signExtend, IntegerConvertOp<Narrow> narrow, Stream<FloatConvertOp> floatConvert) { 155 this.neg = neg; 156 this.add = add; 157 this.sub = sub; 158 this.mul = mul; 159 this.div = div; 160 this.rem = rem; 161 this.not = not; 162 this.and = and; 163 this.or = or; 164 this.xor = xor; 165 this.shl = shl; 166 this.shr = shr; 167 this.ushr = ushr; 168 this.abs = abs; 169 this.sqrt = sqrt; 170 this.zeroExtend = zeroExtend; 171 this.signExtend = signExtend; 172 this.narrow = narrow; 173 this.floatConvert = new FloatConvertOp[FloatConvert.values().length]; 174 floatConvert.forEach(op -> this.floatConvert[op.getFloatConvert().ordinal()] = op); 175 176 this.hash = Objects.hash(neg, add, sub, mul, div, rem, not, and, or, xor, shl, shr, ushr, abs, sqrt, zeroExtend, signExtend, narrow); 177 } 178 179 @Override 180 public int hashCode() { 181 return hash; 182 } 183 184 /** 185 * Describes the unary negation operation. 186 */ 187 public UnaryOp<Neg> getNeg() { 188 return neg; 189 } 190 191 /** 192 * Describes the addition operation. 193 */ 194 public BinaryOp<Add> getAdd() { 195 return add; 196 } 197 198 /** 199 * Describes the subtraction operation. 200 */ 201 public BinaryOp<Sub> getSub() { 202 return sub; 203 } 204 205 /** 206 * Describes the multiplication operation. 207 */ 208 public BinaryOp<Mul> getMul() { 209 return mul; 210 } 211 212 /** 213 * Describes the division operation. 214 */ 215 public BinaryOp<Div> getDiv() { 216 return div; 217 } 218 219 /** 220 * Describes the remainder operation. 221 */ 222 public BinaryOp<Rem> getRem() { 223 return rem; 224 } 225 226 /** 227 * Describes the bitwise not operation. 228 */ 229 public UnaryOp<Not> getNot() { 230 return not; 231 } 232 233 /** 234 * Describes the bitwise and operation. 235 */ 236 public BinaryOp<And> getAnd() { 237 return and; 238 } 239 240 /** 241 * Describes the bitwise or operation. 242 */ 243 public BinaryOp<Or> getOr() { 244 return or; 245 } 246 247 /** 248 * Describes the bitwise xor operation. 249 */ 250 public BinaryOp<Xor> getXor() { 251 return xor; 252 } 253 254 /** 255 * Describes the shift left operation. 256 */ 257 public ShiftOp<Shl> getShl() { 258 return shl; 259 } 260 261 /** 262 * Describes the signed shift right operation. 263 */ 264 public ShiftOp<Shr> getShr() { 265 return shr; 266 } 267 268 /** 269 * Describes the unsigned shift right operation. 270 */ 271 public ShiftOp<UShr> getUShr() { 272 return ushr; 273 } 274 275 /** 276 * Describes the absolute value operation. 277 */ 278 public UnaryOp<Abs> getAbs() { 279 return abs; 280 } 281 282 /** 283 * Describes the square root operation. 284 */ 285 public UnaryOp<Sqrt> getSqrt() { 286 return sqrt; 287 } 288 289 /** 290 * Describes the zero extend conversion. 291 */ 292 public IntegerConvertOp<ZeroExtend> getZeroExtend() { 293 return zeroExtend; 294 } 295 296 /** 297 * Describes the sign extend conversion. 298 */ 299 public IntegerConvertOp<SignExtend> getSignExtend() { 300 return signExtend; 301 } 302 303 /** 304 * Describes the narrowing conversion. 305 */ 306 public IntegerConvertOp<Narrow> getNarrow() { 307 return narrow; 308 } 309 310 /** 311 * Describes integer/float/double conversions. 312 */ 313 public FloatConvertOp getFloatConvert(FloatConvert op) { 314 return floatConvert[op.ordinal()]; 315 } 316 317 public static String toString(Op... ops) { 318 return Arrays.asList(ops).stream().map(o -> o == null ? "null" : o.operator + "{" + getSimpleName(o.getClass(), false) + "}").collect(Collectors.joining(",")); 319 } 320 321 private boolean opsEquals(ArithmeticOpTable that) { 322 // @formatter:off 323 return Objects.equals(neg, that.neg) && 324 Objects.equals(add, that.add) && 325 Objects.equals(sub, that.sub) && 326 Objects.equals(mul, that.mul) && 327 Objects.equals(div, that.div) && 328 Objects.equals(rem, that.rem) && 329 Objects.equals(not, that.not) && 330 Objects.equals(and, that.and) && 331 Objects.equals(or, that.or) && 332 Objects.equals(xor, that.xor) && 333 Objects.equals(shl, that.shl) && 334 Objects.equals(shr, that.shr) && 335 Objects.equals(ushr, that.ushr) && 336 Objects.equals(abs, that.abs) && 337 Objects.equals(sqrt, that.sqrt) && 338 Objects.equals(zeroExtend, that.zeroExtend) && 339 Objects.equals(signExtend, that.signExtend) && 340 Objects.equals(narrow, that.narrow); 341 // @formatter:on 342 } 343 344 @Override 345 public boolean equals(Object obj) { 346 if (this == obj) { 347 return true; 348 } 349 if (obj == null) { 350 return false; 351 } 352 if (getClass() != obj.getClass()) { 353 return false; 354 } 355 ArithmeticOpTable that = (ArithmeticOpTable) obj; 356 if (opsEquals(that)) { 357 if (Arrays.equals(this.floatConvert, that.floatConvert)) { 358 return true; 359 } 360 } 361 return false; 362 } 363 364 @Override 365 public String toString() { 366 return getClass().getSimpleName() + "[" + toString(neg, add, sub, mul, div, rem, not, and, or, xor, shl, shr, ushr, abs, sqrt, zeroExtend, signExtend, narrow) + ",floatConvert[" + 367 toString(floatConvert) + "]]"; 368 } 369 370 public abstract static class Op { 371 372 private final String operator; 373 374 protected Op(String operator) { 375 this.operator = operator; 376 } 377 378 @Override 379 public String toString() { 380 return operator; 381 } 382 383 @Override 384 public int hashCode() { 385 return operator.hashCode(); 386 } 387 388 @Override 389 public boolean equals(Object obj) { 390 if (this == obj) { 391 return true; 392 } 393 if (obj == null) { 394 return false; 395 } 396 if (getClass() != obj.getClass()) { 397 return false; 398 } 399 Op that = (Op) obj; 400 if (operator.equals(that.operator)) { 401 return true; 402 } 403 return true; 404 } 405 } 406 407 /** 408 * Describes a unary arithmetic operation. 409 */ 410 public abstract static class UnaryOp<T> extends Op { 411 412 public abstract static class Neg extends UnaryOp<Neg> { 413 414 protected Neg() { 415 super("-"); 416 } 417 } 418 419 public abstract static class Not extends UnaryOp<Not> { 420 421 protected Not() { 422 super("~"); 423 } 424 } 425 426 public abstract static class Abs extends UnaryOp<Abs> { 427 428 protected Abs() { 429 super("ABS"); 430 } 431 } 432 433 public abstract static class Sqrt extends UnaryOp<Sqrt> { 434 435 protected Sqrt() { 436 super("SQRT"); 437 } 438 } 439 440 protected UnaryOp(String operation) { 441 super(operation); 442 } 443 444 /** 445 * Apply the operation to a {@link Constant}. 446 */ 447 public abstract Constant foldConstant(Constant value); 448 449 /** 450 * Apply the operation to a {@link Stamp}. 451 */ 452 public abstract Stamp foldStamp(Stamp stamp); 453 454 public UnaryOp<T> unwrap() { 455 return this; 456 } 457 } 458 459 /** 460 * Describes a binary arithmetic operation. 461 */ 462 public abstract static class BinaryOp<T> extends Op { 463 464 public abstract static class Add extends BinaryOp<Add> { 465 466 protected Add(boolean associative, boolean commutative) { 467 super("+", associative, commutative); 468 } 469 } 470 471 public abstract static class Sub extends BinaryOp<Sub> { 472 473 protected Sub(boolean associative, boolean commutative) { 474 super("-", associative, commutative); 475 } 476 } 477 478 public abstract static class Mul extends BinaryOp<Mul> { 479 480 protected Mul(boolean associative, boolean commutative) { 481 super("*", associative, commutative); 482 } 483 } 484 485 public abstract static class Div extends BinaryOp<Div> { 486 487 protected Div(boolean associative, boolean commutative) { 488 super("/", associative, commutative); 489 } 490 } 491 492 public abstract static class Rem extends BinaryOp<Rem> { 493 494 protected Rem(boolean associative, boolean commutative) { 495 super("%", associative, commutative); 496 } 497 } 498 499 public abstract static class And extends BinaryOp<And> { 500 501 protected And(boolean associative, boolean commutative) { 502 super("&", associative, commutative); 503 } 504 } 505 506 public abstract static class Or extends BinaryOp<Or> { 507 508 protected Or(boolean associative, boolean commutative) { 509 super("|", associative, commutative); 510 } 511 } 512 513 public abstract static class Xor extends BinaryOp<Xor> { 514 515 protected Xor(boolean associative, boolean commutative) { 516 super("^", associative, commutative); 517 } 518 } 519 520 private final boolean associative; 521 private final boolean commutative; 522 523 protected BinaryOp(String operation, boolean associative, boolean commutative) { 524 super(operation); 525 this.associative = associative; 526 this.commutative = commutative; 527 } 528 529 /** 530 * Apply the operation to two {@linkplain Constant Constants}. 531 */ 532 public abstract Constant foldConstant(Constant a, Constant b); 533 534 /** 535 * Apply the operation to two {@linkplain Stamp Stamps}. 536 */ 537 public abstract Stamp foldStamp(Stamp a, Stamp b); 538 539 /** 540 * Checks whether this operation is associative. An operation is associative when 541 * {@code (a . b) . c == a . (b . c)} for all a, b, c. Note that you still have to be 542 * careful with inverses. For example the integer subtraction operation will report 543 * {@code true} here, since you can still reassociate as long as the correct negations are 544 * inserted. 545 */ 546 public final boolean isAssociative() { 547 return associative; 548 } 549 550 /** 551 * Checks whether this operation is commutative. An operation is commutative when 552 * {@code a . b == b . a} for all a, b. 553 */ 554 public final boolean isCommutative() { 555 return commutative; 556 } 557 558 /** 559 * Check whether a {@link Constant} is a neutral element for this operation. A neutral 560 * element is any element {@code n} where {@code a . n == a} for all a. 561 * 562 * @param n the {@link Constant} that should be tested 563 * @return true iff for all {@code a}: {@code a . n == a} 564 */ 565 public boolean isNeutral(Constant n) { 566 return false; 567 } 568 569 /** 570 * Check whether this operation has a zero {@code z == a . a} for each a. Examples of 571 * operations having such an element are subtraction and exclusive-or. Note that this may be 572 * different from the numbers tested by {@link #isNeutral}. 573 * 574 * @param stamp a {@link Stamp} 575 * @return a unique {@code z} such that {@code z == a . a} for each {@code a} in 576 * {@code stamp} if it exists, otherwise {@code null} 577 */ 578 public Constant getZero(Stamp stamp) { 579 return null; 580 } 581 582 public BinaryOp<T> unwrap() { 583 return this; 584 } 585 586 @Override 587 public int hashCode() { 588 final int prime = 31; 589 int result = super.hashCode(); 590 result = prime * result + (associative ? 1231 : 1237); 591 result = prime * result + (commutative ? 1231 : 1237); 592 return result; 593 } 594 595 @Override 596 public boolean equals(Object obj) { 597 if (this == obj) { 598 return true; 599 } 600 if (!super.equals(obj)) { 601 return false; 602 } 603 if (getClass() != obj.getClass()) { 604 return false; 605 } 606 BinaryOp<?> that = (BinaryOp<?>) obj; 607 if (associative != that.associative) { 608 return false; 609 } 610 if (commutative != that.commutative) { 611 return false; 612 } 613 return true; 614 } 615 616 @Override 617 public String toString() { 618 if (associative) { 619 if (commutative) { 620 return super.toString() + "[AC]"; 621 } else { 622 return super.toString() + "[A]"; 623 } 624 } else if (commutative) { 625 return super.toString() + "[C]"; 626 } 627 return super.toString(); 628 } 629 } 630 631 /** 632 * Describes a shift operation. The right argument of a shift operation always has kind 633 * {@link Kind#Int}. 634 */ 635 public abstract static class ShiftOp<OP> extends Op { 636 637 public abstract static class Shl extends ShiftOp<Shl> { 638 639 public Shl() { 640 super("<<"); 641 } 642 } 643 644 public abstract static class Shr extends ShiftOp<Shr> { 645 646 public Shr() { 647 super(">>"); 648 } 649 } 650 651 public abstract static class UShr extends ShiftOp<UShr> { 652 653 public UShr() { 654 super(">>>"); 655 } 656 } 657 658 protected ShiftOp(String operation) { 659 super(operation); 660 } 661 662 /** 663 * Apply the shift to a constant. 664 */ 665 public abstract Constant foldConstant(Constant c, int amount); 666 667 /** 668 * Apply the shift to a stamp. 669 */ 670 public abstract Stamp foldStamp(Stamp s, IntegerStamp amount); 671 672 /** 673 * Get the shift amount mask for a given result stamp. 674 */ 675 public abstract int getShiftAmountMask(Stamp s); 676 } 677 678 public abstract static class FloatConvertOp extends UnaryOp<FloatConvertOp> { 679 680 private final FloatConvert op; 681 682 protected FloatConvertOp(FloatConvert op) { 683 super(op.name()); 684 this.op = op; 685 } 686 687 public FloatConvert getFloatConvert() { 688 return op; 689 } 690 691 @Override 692 public FloatConvertOp unwrap() { 693 return this; 694 } 695 696 @Override 697 public int hashCode() { 698 final int prime = 31; 699 return prime * super.hashCode() + op.hashCode(); 700 } 701 702 @Override 703 public boolean equals(Object obj) { 704 if (this == obj) { 705 return true; 706 } 707 if (!super.equals(obj)) { 708 return false; 709 } 710 if (getClass() != obj.getClass()) { 711 return false; 712 } 713 FloatConvertOp that = (FloatConvertOp) obj; 714 if (op != that.op) { 715 return false; 716 } 717 return true; 718 } 719 } 720 721 public abstract static class IntegerConvertOp<T> extends Op { 722 723 public abstract static class ZeroExtend extends IntegerConvertOp<ZeroExtend> { 724 725 protected ZeroExtend() { 726 super("ZeroExtend"); 727 } 728 } 729 730 public abstract static class SignExtend extends IntegerConvertOp<SignExtend> { 731 732 protected SignExtend() { 733 super("SignExtend"); 734 } 735 } 736 737 public abstract static class Narrow extends IntegerConvertOp<Narrow> { 738 739 protected Narrow() { 740 super("Narrow"); 741 } 742 } 743 744 protected IntegerConvertOp(String op) { 745 super(op); 746 } 747 748 public abstract Constant foldConstant(int inputBits, int resultBits, Constant value); 749 750 public abstract Stamp foldStamp(int inputBits, int resultBits, Stamp stamp); 751 752 public IntegerConvertOp<T> unwrap() { 753 return this; 754 } 755 } 756}