|
1 /* |
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
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 |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 * |
|
23 */ |
|
24 |
|
25 #ifndef SHARE_VM_OPTO_MATHEXACTNODE_HPP |
|
26 #define SHARE_VM_OPTO_MATHEXACTNODE_HPP |
|
27 |
|
28 #include "opto/multnode.hpp" |
|
29 #include "opto/node.hpp" |
|
30 #include "opto/addnode.hpp" |
|
31 #include "opto/subnode.hpp" |
|
32 #include "opto/type.hpp" |
|
33 |
|
34 class PhaseGVN; |
|
35 class PhaseTransform; |
|
36 |
|
37 class OverflowNode : public CmpNode { |
|
38 public: |
|
39 OverflowNode(Node* in1, Node* in2) : CmpNode(in1, in2) {} |
|
40 |
|
41 virtual uint ideal_reg() const { return Op_RegFlags; } |
|
42 virtual const Type* sub(const Type* t1, const Type* t2) const; |
|
43 }; |
|
44 |
|
45 class OverflowINode : public OverflowNode { |
|
46 public: |
|
47 typedef TypeInt TypeClass; |
|
48 |
|
49 OverflowINode(Node* in1, Node* in2) : OverflowNode(in1, in2) {} |
|
50 virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); |
|
51 virtual const Type* Value(PhaseTransform* phase) const; |
|
52 |
|
53 virtual bool will_overflow(jint v1, jint v2) const = 0; |
|
54 virtual bool can_overflow(const Type* t1, const Type* t2) const = 0; |
|
55 }; |
|
56 |
|
57 |
|
58 class OverflowLNode : public OverflowNode { |
|
59 public: |
|
60 typedef TypeLong TypeClass; |
|
61 |
|
62 OverflowLNode(Node* in1, Node* in2) : OverflowNode(in1, in2) {} |
|
63 virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); |
|
64 virtual const Type* Value(PhaseTransform* phase) const; |
|
65 |
|
66 virtual bool will_overflow(jlong v1, jlong v2) const = 0; |
|
67 virtual bool can_overflow(const Type* t1, const Type* t2) const = 0; |
|
68 }; |
|
69 |
|
70 class OverflowAddINode : public OverflowINode { |
|
71 public: |
|
72 typedef AddINode MathOp; |
|
73 |
|
74 OverflowAddINode(Node* in1, Node* in2) : OverflowINode(in1, in2) {} |
|
75 virtual int Opcode() const; |
|
76 |
|
77 virtual bool will_overflow(jint v1, jint v2) const; |
|
78 virtual bool can_overflow(const Type* t1, const Type* t2) const; |
|
79 }; |
|
80 |
|
81 class OverflowSubINode : public OverflowINode { |
|
82 public: |
|
83 typedef SubINode MathOp; |
|
84 |
|
85 OverflowSubINode(Node* in1, Node* in2) : OverflowINode(in1, in2) {} |
|
86 virtual int Opcode() const; |
|
87 |
|
88 virtual bool will_overflow(jint v1, jint v2) const; |
|
89 virtual bool can_overflow(const Type* t1, const Type* t2) const; |
|
90 }; |
|
91 |
|
92 class OverflowMulINode : public OverflowINode { |
|
93 public: |
|
94 typedef MulINode MathOp; |
|
95 |
|
96 OverflowMulINode(Node* in1, Node* in2) : OverflowINode(in1, in2) {} |
|
97 virtual int Opcode() const; |
|
98 |
|
99 virtual bool will_overflow(jint v1, jint v2) const; |
|
100 virtual bool can_overflow(const Type* t1, const Type* t2) const; |
|
101 }; |
|
102 |
|
103 class OverflowAddLNode : public OverflowLNode { |
|
104 public: |
|
105 typedef AddLNode MathOp; |
|
106 |
|
107 OverflowAddLNode(Node* in1, Node* in2) : OverflowLNode(in1, in2) {} |
|
108 virtual int Opcode() const; |
|
109 |
|
110 virtual bool will_overflow(jlong v1, jlong v2) const; |
|
111 virtual bool can_overflow(const Type* t1, const Type* t2) const; |
|
112 }; |
|
113 |
|
114 class OverflowSubLNode : public OverflowLNode { |
|
115 public: |
|
116 typedef SubLNode MathOp; |
|
117 |
|
118 OverflowSubLNode(Node* in1, Node* in2) : OverflowLNode(in1, in2) {} |
|
119 virtual int Opcode() const; |
|
120 |
|
121 virtual bool will_overflow(jlong v1, jlong v2) const; |
|
122 virtual bool can_overflow(const Type* t1, const Type* t2) const; |
|
123 }; |
|
124 |
|
125 class OverflowMulLNode : public OverflowLNode { |
|
126 public: |
|
127 typedef MulLNode MathOp; |
|
128 |
|
129 OverflowMulLNode(Node* in1, Node* in2) : OverflowLNode(in1, in2) {} |
|
130 virtual int Opcode() const; |
|
131 |
|
132 virtual bool will_overflow(jlong v1, jlong v2) const; |
|
133 virtual bool can_overflow(const Type* t1, const Type* t2) const; |
|
134 }; |
|
135 |
|
136 #endif |
|
137 |