< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/UnpackEndianHalfNode.java

Print this page
rev 52509 : [mq]: graal


  52     protected UnpackEndianHalfNode(ValueNode value, boolean firstHalf) {
  53         super(TYPE, StampFactory.forKind(JavaKind.Int), value);
  54         assert value.getStackKind() == JavaKind.Double || value.getStackKind() == JavaKind.Long : "unexpected kind " + value.getStackKind();
  55         this.firstHalf = firstHalf;
  56     }
  57 
  58     @SuppressWarnings("unused")
  59     public static ValueNode create(ValueNode value, boolean firstHalf, NodeView view) {
  60         if (value.isConstant() && value.asConstant().isDefaultForKind()) {
  61             return ConstantNode.defaultForKind(JavaKind.Int);
  62         }
  63         return new UnpackEndianHalfNode(value, firstHalf);
  64     }
  65 
  66     public boolean isFirstHalf() {
  67         return firstHalf;
  68     }
  69 
  70     @Override
  71     public Node canonical(CanonicalizerTool tool, ValueNode forValue) {
  72         if (forValue.isConstant() && forValue.asConstant().isDefaultForKind()) {
  73             return ConstantNode.defaultForKind(stamp.getStackKind());
  74         }
  75         return this;
  76     }
  77 
  78     @Override
  79     public void lower(LoweringTool tool) {
  80         tool.getLowerer().lower(this, tool);
  81     }
  82 
  83     public void lower(ByteOrder byteOrder) {
  84         ValueNode result = value;
  85         if (value.getStackKind() == JavaKind.Double) {
  86             result = graph().unique(new ReinterpretNode(JavaKind.Long, value));
  87         }
  88         if ((byteOrder == ByteOrder.BIG_ENDIAN) == firstHalf) {
  89             result = graph().unique(new UnsignedRightShiftNode(result, ConstantNode.forInt(32, graph())));
  90         }
  91         result = IntegerConvertNode.convert(result, StampFactory.forKind(JavaKind.Int), graph(), NodeView.DEFAULT);
  92         replaceAtUsagesAndDelete(result);


  52     protected UnpackEndianHalfNode(ValueNode value, boolean firstHalf) {
  53         super(TYPE, StampFactory.forKind(JavaKind.Int), value);
  54         assert value.getStackKind() == JavaKind.Double || value.getStackKind() == JavaKind.Long : "unexpected kind " + value.getStackKind();
  55         this.firstHalf = firstHalf;
  56     }
  57 
  58     @SuppressWarnings("unused")
  59     public static ValueNode create(ValueNode value, boolean firstHalf, NodeView view) {
  60         if (value.isConstant() && value.asConstant().isDefaultForKind()) {
  61             return ConstantNode.defaultForKind(JavaKind.Int);
  62         }
  63         return new UnpackEndianHalfNode(value, firstHalf);
  64     }
  65 
  66     public boolean isFirstHalf() {
  67         return firstHalf;
  68     }
  69 
  70     @Override
  71     public Node canonical(CanonicalizerTool tool, ValueNode forValue) {
  72         if (forValue.isDefaultConstant()) {
  73             return ConstantNode.defaultForKind(stamp.getStackKind());
  74         }
  75         return this;
  76     }
  77 
  78     @Override
  79     public void lower(LoweringTool tool) {
  80         tool.getLowerer().lower(this, tool);
  81     }
  82 
  83     public void lower(ByteOrder byteOrder) {
  84         ValueNode result = value;
  85         if (value.getStackKind() == JavaKind.Double) {
  86             result = graph().unique(new ReinterpretNode(JavaKind.Long, value));
  87         }
  88         if ((byteOrder == ByteOrder.BIG_ENDIAN) == firstHalf) {
  89             result = graph().unique(new UnsignedRightShiftNode(result, ConstantNode.forInt(32, graph())));
  90         }
  91         result = IntegerConvertNode.convert(result, StampFactory.forKind(JavaKind.Int), graph(), NodeView.DEFAULT);
  92         replaceAtUsagesAndDelete(result);
< prev index next >