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