Path: blob/master/src/hotspot/share/opto/convertnode.hpp
40930 views
/*1* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_OPTO_CONVERTNODE_HPP25#define SHARE_OPTO_CONVERTNODE_HPP2627#include "opto/node.hpp"28#include "opto/opcodes.hpp"293031//------------------------------Conv2BNode-------------------------------------32// Convert int/pointer to a Boolean. Map zero to zero, all else to 1.33class Conv2BNode : public Node {34public:35Conv2BNode( Node *i ) : Node(0,i) {}36virtual int Opcode() const;37virtual const Type *bottom_type() const { return TypeInt::BOOL; }38virtual Node* Identity(PhaseGVN* phase);39virtual const Type* Value(PhaseGVN* phase) const;40virtual uint ideal_reg() const { return Op_RegI; }41};4243// The conversions operations are all Alpha sorted. Please keep it that way!44//------------------------------ConvD2FNode------------------------------------45// Convert double to float46class ConvD2FNode : public Node {47public:48ConvD2FNode( Node *in1 ) : Node(0,in1) {}49virtual int Opcode() const;50virtual const Type *bottom_type() const { return Type::FLOAT; }51virtual const Type* Value(PhaseGVN* phase) const;52virtual Node* Identity(PhaseGVN* phase);53virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);54virtual uint ideal_reg() const { return Op_RegF; }55};5657//------------------------------ConvD2INode------------------------------------58// Convert Double to Integer59class ConvD2INode : public Node {60public:61ConvD2INode( Node *in1 ) : Node(0,in1) {}62virtual int Opcode() const;63virtual const Type *bottom_type() const { return TypeInt::INT; }64virtual const Type* Value(PhaseGVN* phase) const;65virtual Node* Identity(PhaseGVN* phase);66virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);67virtual uint ideal_reg() const { return Op_RegI; }68};6970//------------------------------ConvD2LNode------------------------------------71// Convert Double to Long72class ConvD2LNode : public Node {73public:74ConvD2LNode( Node *dbl ) : Node(0,dbl) {}75virtual int Opcode() const;76virtual const Type *bottom_type() const { return TypeLong::LONG; }77virtual const Type* Value(PhaseGVN* phase) const;78virtual Node* Identity(PhaseGVN* phase);79virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);80virtual uint ideal_reg() const { return Op_RegL; }81};8283//------------------------------ConvF2DNode------------------------------------84// Convert Float to a Double.85class ConvF2DNode : public Node {86public:87ConvF2DNode( Node *in1 ) : Node(0,in1) {}88virtual int Opcode() const;89virtual const Type *bottom_type() const { return Type::DOUBLE; }90virtual const Type* Value(PhaseGVN* phase) const;91virtual uint ideal_reg() const { return Op_RegD; }92};9394//------------------------------ConvF2INode------------------------------------95// Convert float to integer96class ConvF2INode : public Node {97public:98ConvF2INode( Node *in1 ) : Node(0,in1) {}99virtual int Opcode() const;100virtual const Type *bottom_type() const { return TypeInt::INT; }101virtual const Type* Value(PhaseGVN* phase) const;102virtual Node* Identity(PhaseGVN* phase);103virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);104virtual uint ideal_reg() const { return Op_RegI; }105};106107//------------------------------ConvF2LNode------------------------------------108// Convert float to long109class ConvF2LNode : public Node {110public:111ConvF2LNode( Node *in1 ) : Node(0,in1) {}112virtual int Opcode() const;113virtual const Type *bottom_type() const { return TypeLong::LONG; }114virtual const Type* Value(PhaseGVN* phase) const;115virtual Node* Identity(PhaseGVN* phase);116virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);117virtual uint ideal_reg() const { return Op_RegL; }118};119120//------------------------------ConvI2DNode------------------------------------121// Convert Integer to Double122class ConvI2DNode : public Node {123public:124ConvI2DNode( Node *in1 ) : Node(0,in1) {}125virtual int Opcode() const;126virtual const Type *bottom_type() const { return Type::DOUBLE; }127virtual const Type* Value(PhaseGVN* phase) const;128virtual uint ideal_reg() const { return Op_RegD; }129};130131//------------------------------ConvI2FNode------------------------------------132// Convert Integer to Float133class ConvI2FNode : public Node {134public:135ConvI2FNode( Node *in1 ) : Node(0,in1) {}136virtual int Opcode() const;137virtual const Type *bottom_type() const { return Type::FLOAT; }138virtual const Type* Value(PhaseGVN* phase) const;139virtual Node* Identity(PhaseGVN* phase);140virtual uint ideal_reg() const { return Op_RegF; }141};142143//------------------------------ConvI2LNode------------------------------------144// Convert integer to long145class ConvI2LNode : public TypeNode {146public:147ConvI2LNode(Node *in1, const TypeLong* t = TypeLong::INT)148: TypeNode(t, 2)149{ init_req(1, in1); }150virtual int Opcode() const;151virtual const Type* Value(PhaseGVN* phase) const;152virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);153virtual uint ideal_reg() const { return Op_RegL; }154};155156//------------------------------ConvL2DNode------------------------------------157// Convert Long to Double158class ConvL2DNode : public Node {159public:160ConvL2DNode( Node *in1 ) : Node(0,in1) {}161virtual int Opcode() const;162virtual const Type *bottom_type() const { return Type::DOUBLE; }163virtual const Type* Value(PhaseGVN* phase) const;164virtual uint ideal_reg() const { return Op_RegD; }165};166167//------------------------------ConvL2FNode------------------------------------168// Convert Long to Float169class ConvL2FNode : public Node {170public:171ConvL2FNode( Node *in1 ) : Node(0,in1) {}172virtual int Opcode() const;173virtual const Type *bottom_type() const { return Type::FLOAT; }174virtual const Type* Value(PhaseGVN* phase) const;175virtual uint ideal_reg() const { return Op_RegF; }176};177178//------------------------------ConvL2INode------------------------------------179// Convert long to integer180class ConvL2INode : public TypeNode {181public:182ConvL2INode(Node *in1, const TypeInt* t = TypeInt::INT)183: TypeNode(t, 2) {184init_req(1, in1);185}186virtual int Opcode() const;187virtual Node* Identity(PhaseGVN* phase);188virtual const Type* Value(PhaseGVN* phase) const;189virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);190virtual uint ideal_reg() const { return Op_RegI; }191};192193//-----------------------------RoundFloatNode----------------------------------194class RoundFloatNode: public Node {195public:196RoundFloatNode(Node* c, Node *in1): Node(c, in1) {}197virtual int Opcode() const;198virtual const Type *bottom_type() const { return Type::FLOAT; }199virtual uint ideal_reg() const { return Op_RegF; }200virtual Node* Identity(PhaseGVN* phase);201virtual const Type* Value(PhaseGVN* phase) const;202};203204205//-----------------------------RoundDoubleNode---------------------------------206class RoundDoubleNode: public Node {207public:208RoundDoubleNode(Node* c, Node *in1): Node(c, in1) {}209virtual int Opcode() const;210virtual const Type *bottom_type() const { return Type::DOUBLE; }211virtual uint ideal_reg() const { return Op_RegD; }212virtual Node* Identity(PhaseGVN* phase);213virtual const Type* Value(PhaseGVN* phase) const;214};215216//-----------------------------RoundDoubleModeNode-----------------------------217class RoundDoubleModeNode: public Node {218public:219enum RoundingMode {220rmode_rint = 0,221rmode_floor = 1,222rmode_ceil = 2223};224RoundDoubleModeNode(Node *in1, Node * rmode): Node(0, in1, rmode) {}225static RoundDoubleModeNode* make(PhaseGVN& gvn, Node* arg, RoundDoubleModeNode::RoundingMode rmode);226virtual int Opcode() const;227virtual const Type *bottom_type() const { return Type::DOUBLE; }228virtual uint ideal_reg() const { return Op_RegD; }229virtual Node* Identity(PhaseGVN* phase);230virtual const Type* Value(PhaseGVN* phase) const;231};232233234#endif // SHARE_OPTO_CONVERTNODE_HPP235236237