< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/LIRValueUtil.java

Print this page




  54         return value instanceof ConstantValue;
  55     }
  56 
  57     public static ConstantValue asConstantValue(Value value) {
  58         assert value != null;
  59         return (ConstantValue) value;
  60     }
  61 
  62     public static Constant asConstant(Value value) {
  63         return asConstantValue(value).getConstant();
  64     }
  65 
  66     public static boolean isJavaConstant(Value value) {
  67         return isConstantValue(value) && asConstantValue(value).isJavaConstant();
  68     }
  69 
  70     public static JavaConstant asJavaConstant(Value value) {
  71         return asConstantValue(value).getJavaConstant();
  72     }
  73 





  74     public static boolean isIntConstant(Value value, long expected) {
  75         if (isJavaConstant(value)) {
  76             JavaConstant javaConstant = asJavaConstant(value);
  77             if (javaConstant != null && javaConstant.getJavaKind().isNumericInteger()) {
  78                 return javaConstant.asLong() == expected;
  79             }
  80         }
  81         return false;
  82     }
  83 
  84     public static boolean isStackSlotValue(Value value) {
  85         assert value != null;
  86         return value instanceof StackSlot || value instanceof VirtualStackSlot;
  87     }
  88 
  89     public static boolean isVirtualStackSlot(Value value) {
  90         assert value != null;
  91         return value instanceof VirtualStackSlot;
  92     }
  93 




  54         return value instanceof ConstantValue;
  55     }
  56 
  57     public static ConstantValue asConstantValue(Value value) {
  58         assert value != null;
  59         return (ConstantValue) value;
  60     }
  61 
  62     public static Constant asConstant(Value value) {
  63         return asConstantValue(value).getConstant();
  64     }
  65 
  66     public static boolean isJavaConstant(Value value) {
  67         return isConstantValue(value) && asConstantValue(value).isJavaConstant();
  68     }
  69 
  70     public static JavaConstant asJavaConstant(Value value) {
  71         return asConstantValue(value).getJavaConstant();
  72     }
  73 
  74     public static boolean isNullConstant(Value value) {
  75         assert value != null;
  76         return isJavaConstant(value) && asJavaConstant(value).isNull();
  77     }
  78 
  79     public static boolean isIntConstant(Value value, long expected) {
  80         if (isJavaConstant(value)) {
  81             JavaConstant javaConstant = asJavaConstant(value);
  82             if (javaConstant != null && javaConstant.getJavaKind().isNumericInteger()) {
  83                 return javaConstant.asLong() == expected;
  84             }
  85         }
  86         return false;
  87     }
  88 
  89     public static boolean isStackSlotValue(Value value) {
  90         assert value != null;
  91         return value instanceof StackSlot || value instanceof VirtualStackSlot;
  92     }
  93 
  94     public static boolean isVirtualStackSlot(Value value) {
  95         assert value != null;
  96         return value instanceof VirtualStackSlot;
  97     }
  98 


< prev index next >