src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/RightShiftNode.java
changeset 58533 46b0b7fe255c
parent 54084 84f10bbf993f
equal deleted inserted replaced
58532:b4f2e13d20ea 58533:46b0b7fe255c
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    22  */
    22  */
    23 
    23 
    24 
    24 
    25 package org.graalvm.compiler.nodes.calc;
    25 package org.graalvm.compiler.nodes.calc;
    26 
    26 
       
    27 import static org.graalvm.compiler.nodes.calc.BinaryArithmeticNode.getArithmeticOpTable;
       
    28 
    27 import org.graalvm.compiler.core.common.type.ArithmeticOpTable;
    29 import org.graalvm.compiler.core.common.type.ArithmeticOpTable;
       
    30 import org.graalvm.compiler.core.common.type.ArithmeticOpTable.ShiftOp;
    28 import org.graalvm.compiler.core.common.type.ArithmeticOpTable.ShiftOp.Shr;
    31 import org.graalvm.compiler.core.common.type.ArithmeticOpTable.ShiftOp.Shr;
    29 import org.graalvm.compiler.core.common.type.IntegerStamp;
    32 import org.graalvm.compiler.core.common.type.IntegerStamp;
    30 import org.graalvm.compiler.core.common.type.Stamp;
    33 import org.graalvm.compiler.core.common.type.Stamp;
    31 import org.graalvm.compiler.graph.NodeClass;
    34 import org.graalvm.compiler.graph.NodeClass;
    32 import org.graalvm.compiler.graph.spi.CanonicalizerTool;
    35 import org.graalvm.compiler.graph.spi.CanonicalizerTool;
    43 public final class RightShiftNode extends ShiftNode<Shr> {
    46 public final class RightShiftNode extends ShiftNode<Shr> {
    44 
    47 
    45     public static final NodeClass<RightShiftNode> TYPE = NodeClass.create(RightShiftNode.class);
    48     public static final NodeClass<RightShiftNode> TYPE = NodeClass.create(RightShiftNode.class);
    46 
    49 
    47     public RightShiftNode(ValueNode x, ValueNode y) {
    50     public RightShiftNode(ValueNode x, ValueNode y) {
    48         super(TYPE, ArithmeticOpTable::getShr, x, y);
    51         super(TYPE, getArithmeticOpTable(x).getShr(), x, y);
    49     }
    52     }
    50 
    53 
    51     public static ValueNode create(ValueNode x, int y, NodeView view) {
    54     public static ValueNode create(ValueNode x, int y, NodeView view) {
    52         if (y == 0) {
    55         if (y == 0) {
    53             return x;
    56             return x;
    62         if (value != null) {
    65         if (value != null) {
    63             return value;
    66             return value;
    64         }
    67         }
    65 
    68 
    66         return canonical(null, op, stamp, x, y, view);
    69         return canonical(null, op, stamp, x, y, view);
       
    70     }
       
    71 
       
    72     @Override
       
    73     protected ShiftOp<Shr> getOp(ArithmeticOpTable table) {
       
    74         return table.getShr();
    67     }
    75     }
    68 
    76 
    69     @Override
    77     @Override
    70     public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
    78     public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
    71         NodeView view = NodeView.from(tool);
    79         NodeView view = NodeView.from(tool);