< prev index next >

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

Print this page




  28 import org.graalvm.compiler.graph.NodeClass;
  29 import org.graalvm.compiler.graph.spi.Canonicalizable;
  30 import org.graalvm.compiler.nodeinfo.NodeInfo;
  31 import org.graalvm.compiler.nodes.ValueNode;
  32 
  33 /**
  34  * The {@code UnaryNode} class is the base of arithmetic and bit logic operations with exactly one
  35  * input.
  36  */
  37 @NodeInfo(size = SIZE_1)
  38 public abstract class UnaryNode extends FloatingNode implements Canonicalizable.Unary<ValueNode> {
  39 
  40     public static final NodeClass<UnaryNode> TYPE = NodeClass.create(UnaryNode.class);
  41     @Input protected ValueNode value;
  42 
  43     @Override
  44     public ValueNode getValue() {
  45         return value;
  46     }
  47 





  48     /**
  49      * Creates a new UnaryNode instance.
  50      *
  51      * @param stamp the result type of this instruction
  52      * @param value the input instruction
  53      */
  54     protected UnaryNode(NodeClass<? extends UnaryNode> c, Stamp stamp, ValueNode value) {
  55         super(c, stamp);
  56         this.value = value;
  57     }
  58 
  59     @Override
  60     public boolean inferStamp() {
  61         return updateStamp(foldStamp(value.stamp()));
  62     }
  63 
  64     /**
  65      * Compute an improved for this node using the passed in stamp. The stamp must be compatible
  66      * with the current value of {@link #value}. This code is used to provide the default
  67      * implementation of {@link #inferStamp()} and may be used by external optimizations.


  28 import org.graalvm.compiler.graph.NodeClass;
  29 import org.graalvm.compiler.graph.spi.Canonicalizable;
  30 import org.graalvm.compiler.nodeinfo.NodeInfo;
  31 import org.graalvm.compiler.nodes.ValueNode;
  32 
  33 /**
  34  * The {@code UnaryNode} class is the base of arithmetic and bit logic operations with exactly one
  35  * input.
  36  */
  37 @NodeInfo(size = SIZE_1)
  38 public abstract class UnaryNode extends FloatingNode implements Canonicalizable.Unary<ValueNode> {
  39 
  40     public static final NodeClass<UnaryNode> TYPE = NodeClass.create(UnaryNode.class);
  41     @Input protected ValueNode value;
  42 
  43     @Override
  44     public ValueNode getValue() {
  45         return value;
  46     }
  47 
  48     public void setValue(ValueNode value) {
  49         updateUsages(this.value, value);
  50         this.value = value;
  51     }
  52 
  53     /**
  54      * Creates a new UnaryNode instance.
  55      *
  56      * @param stamp the result type of this instruction
  57      * @param value the input instruction
  58      */
  59     protected UnaryNode(NodeClass<? extends UnaryNode> c, Stamp stamp, ValueNode value) {
  60         super(c, stamp);
  61         this.value = value;
  62     }
  63 
  64     @Override
  65     public boolean inferStamp() {
  66         return updateStamp(foldStamp(value.stamp()));
  67     }
  68 
  69     /**
  70      * Compute an improved for this node using the passed in stamp. The stamp must be compatible
  71      * with the current value of {@link #value}. This code is used to provide the default
  72      * implementation of {@link #inferStamp()} and may be used by external optimizations.
< prev index next >