src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/OrNode.java
changeset 58533 46b0b7fe255c
parent 52910 583fd71c47d6
child 58877 aec7bf35d6f5
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.
    48 public final class OrNode extends BinaryArithmeticNode<Or> implements BinaryCommutative<ValueNode>, NarrowableArithmeticNode {
    48 public final class OrNode extends BinaryArithmeticNode<Or> implements BinaryCommutative<ValueNode>, NarrowableArithmeticNode {
    49 
    49 
    50     public static final NodeClass<OrNode> TYPE = NodeClass.create(OrNode.class);
    50     public static final NodeClass<OrNode> TYPE = NodeClass.create(OrNode.class);
    51 
    51 
    52     public OrNode(ValueNode x, ValueNode y) {
    52     public OrNode(ValueNode x, ValueNode y) {
    53         super(TYPE, ArithmeticOpTable::getOr, x, y);
    53         super(TYPE, getArithmeticOpTable(x).getOr(), x, y);
    54     }
    54     }
    55 
    55 
    56     public static ValueNode create(ValueNode x, ValueNode y, NodeView view) {
    56     public static ValueNode create(ValueNode x, ValueNode y, NodeView view) {
    57         BinaryOp<Or> op = ArithmeticOpTable.forStamp(x.stamp(view)).getOr();
    57         BinaryOp<Or> op = ArithmeticOpTable.forStamp(x.stamp(view)).getOr();
    58         Stamp stamp = op.foldStamp(x.stamp(view), y.stamp(view));
    58         Stamp stamp = op.foldStamp(x.stamp(view), y.stamp(view));
    59         ConstantNode tryConstantFold = tryConstantFold(op, x, y, stamp, view);
    59         ConstantNode tryConstantFold = tryConstantFold(op, x, y, stamp, view);
    60         if (tryConstantFold != null) {
    60         if (tryConstantFold != null) {
    61             return tryConstantFold;
    61             return tryConstantFold;
    62         }
    62         }
    63         return canonical(null, op, stamp, x, y, view);
    63         return canonical(null, op, stamp, x, y, view);
       
    64     }
       
    65 
       
    66     @Override
       
    67     protected BinaryOp<Or> getOp(ArithmeticOpTable table) {
       
    68         return table.getOr();
    64     }
    69     }
    65 
    70 
    66     @Override
    71     @Override
    67     public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
    72     public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
    68         NodeView view = NodeView.from(tool);
    73         NodeView view = NodeView.from(tool);