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 // Portions of code courtesy of Clifford Click 26 27 //------------------------------SUBNode---------------------------------------- 28 // Class SUBTRACTION functionality. This covers all the usual 'subtract' 29 // behaviors. Subtract-integer, -float, -double, binary xor, compare-integer, 30 // -float, and -double are all inherited from this class. The compare 31 // functions behave like subtract functions, except that all negative answers 32 // are compressed into -1, and all positive answers compressed to 1. 33 class SubNode : public Node { 34 public: 35 SubNode( Node *in1, Node *in2 ) : Node(0,in1,in2) { 36 init_class_id(Class_Sub); 37 } 38 39 // Handle algebraic identities here. If we have an identity, return the Node 40 // we are equivalent to. We look for "add of zero" as an identity. 41 virtual Node *Identity( PhaseTransform *phase ); 42 43 // Compute a new Type for this node. Basically we just do the pre-check, 44 // then call the virtual add() to set the type. 512 513 //-------------------------------ReverseBytesUSNode-------------------------------- 514 // reverse bytes of an unsigned short / char 515 class ReverseBytesUSNode : public Node { 516 public: 517 ReverseBytesUSNode(Node *c, Node *in1) : Node(c, in1) {} 518 virtual int Opcode() const; 519 const Type *bottom_type() const { return TypeInt::CHAR; } 520 virtual uint ideal_reg() const { return Op_RegI; } 521 }; 522 523 //-------------------------------ReverseBytesSNode-------------------------------- 524 // reverse bytes of a short 525 class ReverseBytesSNode : public Node { 526 public: 527 ReverseBytesSNode(Node *c, Node *in1) : Node(c, in1) {} 528 virtual int Opcode() const; 529 const Type *bottom_type() const { return TypeInt::SHORT; } 530 virtual uint ideal_reg() const { return Op_RegI; } 531 }; | 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_SUBNODE_HPP 26 #define SHARE_VM_OPTO_SUBNODE_HPP 27 28 #include "opto/node.hpp" 29 #include "opto/opcodes.hpp" 30 #include "opto/type.hpp" 31 32 // Portions of code courtesy of Clifford Click 33 34 //------------------------------SUBNode---------------------------------------- 35 // Class SUBTRACTION functionality. This covers all the usual 'subtract' 36 // behaviors. Subtract-integer, -float, -double, binary xor, compare-integer, 37 // -float, and -double are all inherited from this class. The compare 38 // functions behave like subtract functions, except that all negative answers 39 // are compressed into -1, and all positive answers compressed to 1. 40 class SubNode : public Node { 41 public: 42 SubNode( Node *in1, Node *in2 ) : Node(0,in1,in2) { 43 init_class_id(Class_Sub); 44 } 45 46 // Handle algebraic identities here. If we have an identity, return the Node 47 // we are equivalent to. We look for "add of zero" as an identity. 48 virtual Node *Identity( PhaseTransform *phase ); 49 50 // Compute a new Type for this node. Basically we just do the pre-check, 51 // then call the virtual add() to set the type. 519 520 //-------------------------------ReverseBytesUSNode-------------------------------- 521 // reverse bytes of an unsigned short / char 522 class ReverseBytesUSNode : public Node { 523 public: 524 ReverseBytesUSNode(Node *c, Node *in1) : Node(c, in1) {} 525 virtual int Opcode() const; 526 const Type *bottom_type() const { return TypeInt::CHAR; } 527 virtual uint ideal_reg() const { return Op_RegI; } 528 }; 529 530 //-------------------------------ReverseBytesSNode-------------------------------- 531 // reverse bytes of a short 532 class ReverseBytesSNode : public Node { 533 public: 534 ReverseBytesSNode(Node *c, Node *in1) : Node(c, in1) {} 535 virtual int Opcode() const; 536 const Type *bottom_type() const { return TypeInt::SHORT; } 537 virtual uint ideal_reg() const { return Op_RegI; } 538 }; 539 540 #endif // SHARE_VM_OPTO_SUBNODE_HPP |