src/share/vm/opto/mathexactnode.hpp

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/opto/mathexactnode.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,137 @@
     1.4 +/*
     1.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#ifndef SHARE_VM_OPTO_MATHEXACTNODE_HPP
    1.29 +#define SHARE_VM_OPTO_MATHEXACTNODE_HPP
    1.30 +
    1.31 +#include "opto/multnode.hpp"
    1.32 +#include "opto/node.hpp"
    1.33 +#include "opto/addnode.hpp"
    1.34 +#include "opto/subnode.hpp"
    1.35 +#include "opto/type.hpp"
    1.36 +
    1.37 +class PhaseGVN;
    1.38 +class PhaseTransform;
    1.39 +
    1.40 +class OverflowNode : public CmpNode {
    1.41 +public:
    1.42 +  OverflowNode(Node* in1, Node* in2) : CmpNode(in1, in2) {}
    1.43 +
    1.44 +  virtual uint ideal_reg() const { return Op_RegFlags; }
    1.45 +  virtual const Type* sub(const Type* t1, const Type* t2) const;
    1.46 +};
    1.47 +
    1.48 +class OverflowINode : public OverflowNode {
    1.49 +public:
    1.50 +  typedef TypeInt TypeClass;
    1.51 +
    1.52 +  OverflowINode(Node* in1, Node* in2) : OverflowNode(in1, in2) {}
    1.53 +  virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
    1.54 +  virtual const Type* Value(PhaseTransform* phase) const;
    1.55 +
    1.56 +  virtual bool will_overflow(jint v1, jint v2) const = 0;
    1.57 +  virtual bool can_overflow(const Type* t1, const Type* t2) const = 0;
    1.58 +};
    1.59 +
    1.60 +
    1.61 +class OverflowLNode : public OverflowNode {
    1.62 +public:
    1.63 +  typedef TypeLong TypeClass;
    1.64 +
    1.65 +  OverflowLNode(Node* in1, Node* in2) : OverflowNode(in1, in2) {}
    1.66 +  virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
    1.67 +  virtual const Type* Value(PhaseTransform* phase) const;
    1.68 +
    1.69 +  virtual bool will_overflow(jlong v1, jlong v2) const = 0;
    1.70 +  virtual bool can_overflow(const Type* t1, const Type* t2) const = 0;
    1.71 +};
    1.72 +
    1.73 +class OverflowAddINode : public OverflowINode {
    1.74 +public:
    1.75 +  typedef AddINode MathOp;
    1.76 +
    1.77 +  OverflowAddINode(Node* in1, Node* in2) : OverflowINode(in1, in2) {}
    1.78 +  virtual int Opcode() const;
    1.79 +
    1.80 +  virtual bool will_overflow(jint v1, jint v2) const;
    1.81 +  virtual bool can_overflow(const Type* t1, const Type* t2) const;
    1.82 +};
    1.83 +
    1.84 +class OverflowSubINode : public OverflowINode {
    1.85 +public:
    1.86 +  typedef SubINode MathOp;
    1.87 +
    1.88 +  OverflowSubINode(Node* in1, Node* in2) : OverflowINode(in1, in2) {}
    1.89 +  virtual int Opcode() const;
    1.90 +
    1.91 +  virtual bool will_overflow(jint v1, jint v2) const;
    1.92 +  virtual bool can_overflow(const Type* t1, const Type* t2) const;
    1.93 +};
    1.94 +
    1.95 +class OverflowMulINode : public OverflowINode {
    1.96 +public:
    1.97 +  typedef MulINode MathOp;
    1.98 +
    1.99 +  OverflowMulINode(Node* in1, Node* in2) : OverflowINode(in1, in2) {}
   1.100 +  virtual int Opcode() const;
   1.101 +
   1.102 +  virtual bool will_overflow(jint v1, jint v2) const;
   1.103 +  virtual bool can_overflow(const Type* t1, const Type* t2) const;
   1.104 +};
   1.105 +
   1.106 +class OverflowAddLNode : public OverflowLNode {
   1.107 +public:
   1.108 +  typedef AddLNode MathOp;
   1.109 +
   1.110 +  OverflowAddLNode(Node* in1, Node* in2) : OverflowLNode(in1, in2) {}
   1.111 +  virtual int Opcode() const;
   1.112 +
   1.113 +  virtual bool will_overflow(jlong v1, jlong v2) const;
   1.114 +  virtual bool can_overflow(const Type* t1, const Type* t2) const;
   1.115 +};
   1.116 +
   1.117 +class OverflowSubLNode : public OverflowLNode {
   1.118 +public:
   1.119 +  typedef SubLNode MathOp;
   1.120 +
   1.121 +  OverflowSubLNode(Node* in1, Node* in2) : OverflowLNode(in1, in2) {}
   1.122 +  virtual int Opcode() const;
   1.123 +
   1.124 +  virtual bool will_overflow(jlong v1, jlong v2) const;
   1.125 +  virtual bool can_overflow(const Type* t1, const Type* t2) const;
   1.126 +};
   1.127 +
   1.128 +class OverflowMulLNode : public OverflowLNode {
   1.129 +public:
   1.130 +  typedef MulLNode MathOp;
   1.131 +
   1.132 +  OverflowMulLNode(Node* in1, Node* in2) : OverflowLNode(in1, in2) {}
   1.133 +  virtual int Opcode() const;
   1.134 +
   1.135 +  virtual bool will_overflow(jlong v1, jlong v2) const;
   1.136 +  virtual bool can_overflow(const Type* t1, const Type* t2) const;
   1.137 +};
   1.138 +
   1.139 +#endif
   1.140 +

mercurial