|
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/type.hpp" |
|
31 |
|
32 class Node; |
|
33 |
|
34 class PhaseGVN; |
|
35 class PhaseTransform; |
|
36 |
|
37 class MathExactNode : public MultiNode { |
|
38 public: |
|
39 MathExactNode(Node* ctrl, Node* in1, Node* in2); |
|
40 enum { |
|
41 result_proj_node = 0, |
|
42 flags_proj_node = 1 |
|
43 }; |
|
44 virtual int Opcode() const; |
|
45 virtual Node* Identity(PhaseTransform* phase) { return this; } |
|
46 virtual Node* Ideal(PhaseGVN* phase, bool can_reshape) { return NULL; } |
|
47 virtual const Type* Value(PhaseTransform* phase) const { return bottom_type(); } |
|
48 virtual uint hash() const { return Node::hash(); } |
|
49 virtual bool is_CFG() const { return false; } |
|
50 virtual uint ideal_reg() const { return NotAMachineReg; } |
|
51 |
|
52 ProjNode* result_node() { return proj_out(result_proj_node); } |
|
53 ProjNode* flags_node() { return proj_out(flags_proj_node); } |
|
54 protected: |
|
55 Node* no_overflow(PhaseGVN *phase, Node* new_result); |
|
56 }; |
|
57 |
|
58 class AddExactINode : public MathExactNode { |
|
59 public: |
|
60 AddExactINode(Node* ctrl, Node* in1, Node* in2) : MathExactNode(ctrl, in1, in2) {} |
|
61 virtual int Opcode() const; |
|
62 virtual const Type* bottom_type() const { return TypeTuple::INT_CC_PAIR; } |
|
63 virtual Node* match(const ProjNode* proj, const Matcher* m); |
|
64 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
65 }; |
|
66 |
|
67 class FlagsProjNode : public ProjNode { |
|
68 public: |
|
69 FlagsProjNode(Node* src, uint con) : ProjNode(src, con) { |
|
70 init_class_id(Class_FlagsProj); |
|
71 } |
|
72 |
|
73 virtual int Opcode() const; |
|
74 virtual bool is_CFG() const { return false; } |
|
75 virtual const Type* bottom_type() const { return TypeInt::CC; } |
|
76 virtual uint ideal_reg() const { return Op_RegFlags; } |
|
77 }; |
|
78 |
|
79 |
|
80 #endif |
|
81 |