src/share/vm/opto/mulnode.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7119644 Sdiff src/share/vm/opto

src/share/vm/opto/mulnode.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2010, 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  *


  24 
  25 #ifndef SHARE_VM_OPTO_MULNODE_HPP
  26 #define SHARE_VM_OPTO_MULNODE_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 class PhaseTransform;
  35 
  36 //------------------------------MulNode----------------------------------------
  37 // Classic MULTIPLY functionality.  This covers all the usual 'multiply'
  38 // behaviors for an algebraic ring.  Multiply-integer, multiply-float,
  39 // multiply-double, and binary-and are all inherited from this class.  The
  40 // various identity values are supplied by virtual functions.
  41 class MulNode : public Node {
  42   virtual uint hash() const;
  43 public:
  44   MulNode( Node *in1, Node *in2 ): Node(0,in1,in2) {}


  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   // We also canonicalize the Node, moving constants to the right input,
  51   // and flatten expressions (so that 1+x+2 becomes x+3).
  52   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  53 
  54   // Compute a new Type for this node.  Basically we just do the pre-check,
  55   // then call the virtual add() to set the type.
  56   virtual const Type *Value( PhaseTransform *phase ) const;
  57 
  58   // Supplied function returns the product of the inputs.
  59   // This also type-checks the inputs for sanity.  Guaranteed never to
  60   // be passed a TOP or BOTTOM type, these are filtered out by a pre-check.
  61   // This call recognizes the multiplicative zero type.
  62   virtual const Type *mul_ring( const Type *, const Type * ) const = 0;
  63 
  64   // Supplied function to return the multiplicative identity type


   1 /*
   2  * Copyright (c) 1997, 2012, 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  *


  24 
  25 #ifndef SHARE_VM_OPTO_MULNODE_HPP
  26 #define SHARE_VM_OPTO_MULNODE_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 class PhaseTransform;
  35 
  36 //------------------------------MulNode----------------------------------------
  37 // Classic MULTIPLY functionality.  This covers all the usual 'multiply'
  38 // behaviors for an algebraic ring.  Multiply-integer, multiply-float,
  39 // multiply-double, and binary-and are all inherited from this class.  The
  40 // various identity values are supplied by virtual functions.
  41 class MulNode : public Node {
  42   virtual uint hash() const;
  43 public:
  44   MulNode( Node *in1, Node *in2 ): Node(0,in1,in2) {
  45     init_class_id(Class_Mul);
  46   }
  47 
  48   // Handle algebraic identities here.  If we have an identity, return the Node
  49   // we are equivalent to.  We look for "add of zero" as an identity.
  50   virtual Node *Identity( PhaseTransform *phase );
  51 
  52   // We also canonicalize the Node, moving constants to the right input,
  53   // and flatten expressions (so that 1+x+2 becomes x+3).
  54   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  55 
  56   // Compute a new Type for this node.  Basically we just do the pre-check,
  57   // then call the virtual add() to set the type.
  58   virtual const Type *Value( PhaseTransform *phase ) const;
  59 
  60   // Supplied function returns the product of the inputs.
  61   // This also type-checks the inputs for sanity.  Guaranteed never to
  62   // be passed a TOP or BOTTOM type, these are filtered out by a pre-check.
  63   // This call recognizes the multiplicative zero type.
  64   virtual const Type *mul_ring( const Type *, const Type * ) const = 0;
  65 
  66   // Supplied function to return the multiplicative identity type


src/share/vm/opto/mulnode.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File