< prev index next >

src/share/vm/opto/mulnode.hpp

Print this page
rev 8739 : 8004073: Implement C2 Ideal node specific dump() method
Summary: add Node::dump_rel() to dump a node and its related nodes (the notion of "related" depends on the node at hand); add Node::dump_comp() to dump a node in compact representation; add Node::dump_rel_comp() to dump a node and its related nodes in compact representation; add the required machinery; extend some C2 IR nodes with compact and related dumping
Reviewed-by:
   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  *


  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
  67   virtual const Type *mul_id() const = 0;
  68 
  69   // Supplied function to return the additive identity type
  70   virtual const Type *add_id() const = 0;
  71 
  72   // Supplied function to return the additive opcode
  73   virtual int add_opcode() const = 0;
  74 
  75   // Supplied function to return the multiplicative opcode
  76   virtual int mul_opcode() const = 0;
  77 



  78 };
  79 
  80 //------------------------------MulINode---------------------------------------
  81 // Multiply 2 integers
  82 class MulINode : public MulNode {
  83 public:
  84   MulINode( Node *in1, Node *in2 ) : MulNode(in1,in2) {}
  85   virtual int Opcode() const;
  86   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  87   virtual const Type *mul_ring( const Type *, const Type * ) const;
  88   const Type *mul_id() const { return TypeInt::ONE; }
  89   const Type *add_id() const { return TypeInt::ZERO; }
  90   int add_opcode() const { return Op_AddI; }
  91   int mul_opcode() const { return Op_MulI; }
  92   const Type *bottom_type() const { return TypeInt::INT; }
  93   virtual uint ideal_reg() const { return Op_RegI; }
  94 };
  95 
  96 //------------------------------MulLNode---------------------------------------
  97 // Multiply 2 longs


 132   MulDNode( Node *in1, Node *in2 ) : MulNode(in1,in2) {}
 133   virtual int Opcode() const;
 134   virtual const Type *mul_ring( const Type *, const Type * ) const;
 135   const Type *mul_id() const { return TypeD::ONE; }
 136   const Type *add_id() const { return TypeD::ZERO; }
 137   int add_opcode() const { return Op_AddD; }
 138   int mul_opcode() const { return Op_MulD; }
 139   const Type *bottom_type() const { return Type::DOUBLE; }
 140   virtual uint ideal_reg() const { return Op_RegD; }
 141 };
 142 
 143 //-------------------------------MulHiLNode------------------------------------
 144 // Upper 64 bits of a 64 bit by 64 bit multiply
 145 class MulHiLNode : public Node {
 146 public:
 147   MulHiLNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
 148   virtual int Opcode() const;
 149   virtual const Type *Value( PhaseTransform *phase ) const;
 150   const Type *bottom_type() const { return TypeLong::LONG; }
 151   virtual uint ideal_reg() const { return Op_RegL; }




 152 };
 153 
 154 //------------------------------AndINode---------------------------------------
 155 // Logically AND 2 integers.  Included with the MUL nodes because it inherits
 156 // all the behavior of multiplication on a ring.
 157 class AndINode : public MulINode {
 158 public:
 159   AndINode( Node *in1, Node *in2 ) : MulINode(in1,in2) {}
 160   virtual int Opcode() const;
 161   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 162   virtual Node *Identity( PhaseTransform *phase );
 163   virtual const Type *mul_ring( const Type *, const Type * ) const;
 164   const Type *mul_id() const { return TypeInt::MINUS_1; }
 165   const Type *add_id() const { return TypeInt::ZERO; }
 166   int add_opcode() const { return Op_OrI; }
 167   int mul_opcode() const { return Op_AndI; }
 168   virtual uint ideal_reg() const { return Op_RegI; }
 169 };
 170 
 171 //------------------------------AndINode---------------------------------------


 179   virtual Node *Identity( PhaseTransform *phase );
 180   virtual const Type *mul_ring( const Type *, const Type * ) const;
 181   const Type *mul_id() const { return TypeLong::MINUS_1; }
 182   const Type *add_id() const { return TypeLong::ZERO; }
 183   int add_opcode() const { return Op_OrL; }
 184   int mul_opcode() const { return Op_AndL; }
 185   virtual uint ideal_reg() const { return Op_RegL; }
 186 };
 187 
 188 //------------------------------LShiftINode------------------------------------
 189 // Logical shift left
 190 class LShiftINode : public Node {
 191 public:
 192   LShiftINode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
 193   virtual int Opcode() const;
 194   virtual Node *Identity( PhaseTransform *phase );
 195   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 196   virtual const Type *Value( PhaseTransform *phase ) const;
 197   const Type *bottom_type() const { return TypeInt::INT; }
 198   virtual uint ideal_reg() const { return Op_RegI; }




 199 };
 200 
 201 //------------------------------LShiftLNode------------------------------------
 202 // Logical shift left
 203 class LShiftLNode : public Node {
 204 public:
 205   LShiftLNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
 206   virtual int Opcode() const;
 207   virtual Node *Identity( PhaseTransform *phase );
 208   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 209   virtual const Type *Value( PhaseTransform *phase ) const;
 210   const Type *bottom_type() const { return TypeLong::LONG; }
 211   virtual uint ideal_reg() const { return Op_RegL; }




 212 };
 213 
 214 //------------------------------RShiftINode------------------------------------
 215 // Signed shift right
 216 class RShiftINode : public Node {
 217 public:
 218   RShiftINode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
 219   virtual int Opcode() const;
 220   virtual Node *Identity( PhaseTransform *phase );
 221   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 222   virtual const Type *Value( PhaseTransform *phase ) const;
 223   const Type *bottom_type() const { return TypeInt::INT; }
 224   virtual uint ideal_reg() const { return Op_RegI; }




 225 };
 226 
 227 //------------------------------RShiftLNode------------------------------------
 228 // Signed shift right
 229 class RShiftLNode : public Node {
 230 public:
 231   RShiftLNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
 232   virtual int Opcode() const;
 233   virtual Node *Identity( PhaseTransform *phase );
 234   virtual const Type *Value( PhaseTransform *phase ) const;
 235   const Type *bottom_type() const { return TypeLong::LONG; }
 236   virtual uint ideal_reg() const { return Op_RegL; }




 237 };
 238 
 239 
 240 //------------------------------URShiftINode-----------------------------------
 241 // Logical shift right
 242 class URShiftINode : public Node {
 243 public:
 244   URShiftINode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
 245   virtual int Opcode() const;
 246   virtual Node *Identity( PhaseTransform *phase );
 247   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 248   virtual const Type *Value( PhaseTransform *phase ) const;
 249   const Type *bottom_type() const { return TypeInt::INT; }
 250   virtual uint ideal_reg() const { return Op_RegI; }




 251 };
 252 
 253 //------------------------------URShiftLNode-----------------------------------
 254 // Logical shift right
 255 class URShiftLNode : public Node {
 256 public:
 257   URShiftLNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
 258   virtual int Opcode() const;
 259   virtual Node *Identity( PhaseTransform *phase );
 260   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 261   virtual const Type *Value( PhaseTransform *phase ) const;
 262   const Type *bottom_type() const { return TypeLong::LONG; }
 263   virtual uint ideal_reg() const { return Op_RegL; }




 264 };
 265 
 266 #endif // SHARE_VM_OPTO_MULNODE_HPP
   1 /*
   2  * Copyright (c) 1997, 2015, 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  *


  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
  67   virtual const Type *mul_id() const = 0;
  68 
  69   // Supplied function to return the additive identity type
  70   virtual const Type *add_id() const = 0;
  71 
  72   // Supplied function to return the additive opcode
  73   virtual int add_opcode() const = 0;
  74 
  75   // Supplied function to return the multiplicative opcode
  76   virtual int mul_opcode() const = 0;
  77 
  78 #ifndef PRODUCT
  79   REL_IN_DATA_OUT_1;
  80 #endif
  81 };
  82 
  83 //------------------------------MulINode---------------------------------------
  84 // Multiply 2 integers
  85 class MulINode : public MulNode {
  86 public:
  87   MulINode( Node *in1, Node *in2 ) : MulNode(in1,in2) {}
  88   virtual int Opcode() const;
  89   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  90   virtual const Type *mul_ring( const Type *, const Type * ) const;
  91   const Type *mul_id() const { return TypeInt::ONE; }
  92   const Type *add_id() const { return TypeInt::ZERO; }
  93   int add_opcode() const { return Op_AddI; }
  94   int mul_opcode() const { return Op_MulI; }
  95   const Type *bottom_type() const { return TypeInt::INT; }
  96   virtual uint ideal_reg() const { return Op_RegI; }
  97 };
  98 
  99 //------------------------------MulLNode---------------------------------------
 100 // Multiply 2 longs


 135   MulDNode( Node *in1, Node *in2 ) : MulNode(in1,in2) {}
 136   virtual int Opcode() const;
 137   virtual const Type *mul_ring( const Type *, const Type * ) const;
 138   const Type *mul_id() const { return TypeD::ONE; }
 139   const Type *add_id() const { return TypeD::ZERO; }
 140   int add_opcode() const { return Op_AddD; }
 141   int mul_opcode() const { return Op_MulD; }
 142   const Type *bottom_type() const { return Type::DOUBLE; }
 143   virtual uint ideal_reg() const { return Op_RegD; }
 144 };
 145 
 146 //-------------------------------MulHiLNode------------------------------------
 147 // Upper 64 bits of a 64 bit by 64 bit multiply
 148 class MulHiLNode : public Node {
 149 public:
 150   MulHiLNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
 151   virtual int Opcode() const;
 152   virtual const Type *Value( PhaseTransform *phase ) const;
 153   const Type *bottom_type() const { return TypeLong::LONG; }
 154   virtual uint ideal_reg() const { return Op_RegL; }
 155 
 156 #ifndef PRODUCT
 157   REL_IN_DATA_OUT_1;
 158 #endif
 159 };
 160 
 161 //------------------------------AndINode---------------------------------------
 162 // Logically AND 2 integers.  Included with the MUL nodes because it inherits
 163 // all the behavior of multiplication on a ring.
 164 class AndINode : public MulINode {
 165 public:
 166   AndINode( Node *in1, Node *in2 ) : MulINode(in1,in2) {}
 167   virtual int Opcode() const;
 168   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 169   virtual Node *Identity( PhaseTransform *phase );
 170   virtual const Type *mul_ring( const Type *, const Type * ) const;
 171   const Type *mul_id() const { return TypeInt::MINUS_1; }
 172   const Type *add_id() const { return TypeInt::ZERO; }
 173   int add_opcode() const { return Op_OrI; }
 174   int mul_opcode() const { return Op_AndI; }
 175   virtual uint ideal_reg() const { return Op_RegI; }
 176 };
 177 
 178 //------------------------------AndINode---------------------------------------


 186   virtual Node *Identity( PhaseTransform *phase );
 187   virtual const Type *mul_ring( const Type *, const Type * ) const;
 188   const Type *mul_id() const { return TypeLong::MINUS_1; }
 189   const Type *add_id() const { return TypeLong::ZERO; }
 190   int add_opcode() const { return Op_OrL; }
 191   int mul_opcode() const { return Op_AndL; }
 192   virtual uint ideal_reg() const { return Op_RegL; }
 193 };
 194 
 195 //------------------------------LShiftINode------------------------------------
 196 // Logical shift left
 197 class LShiftINode : public Node {
 198 public:
 199   LShiftINode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
 200   virtual int Opcode() const;
 201   virtual Node *Identity( PhaseTransform *phase );
 202   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 203   virtual const Type *Value( PhaseTransform *phase ) const;
 204   const Type *bottom_type() const { return TypeInt::INT; }
 205   virtual uint ideal_reg() const { return Op_RegI; }
 206 
 207 #ifndef PRODUCT
 208   REL_IN_DATA_OUT_1;
 209 #endif
 210 };
 211 
 212 //------------------------------LShiftLNode------------------------------------
 213 // Logical shift left
 214 class LShiftLNode : public Node {
 215 public:
 216   LShiftLNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
 217   virtual int Opcode() const;
 218   virtual Node *Identity( PhaseTransform *phase );
 219   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 220   virtual const Type *Value( PhaseTransform *phase ) const;
 221   const Type *bottom_type() const { return TypeLong::LONG; }
 222   virtual uint ideal_reg() const { return Op_RegL; }
 223 
 224 #ifndef PRODUCT
 225   REL_IN_DATA_OUT_1;
 226 #endif
 227 };
 228 
 229 //------------------------------RShiftINode------------------------------------
 230 // Signed shift right
 231 class RShiftINode : public Node {
 232 public:
 233   RShiftINode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
 234   virtual int Opcode() const;
 235   virtual Node *Identity( PhaseTransform *phase );
 236   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 237   virtual const Type *Value( PhaseTransform *phase ) const;
 238   const Type *bottom_type() const { return TypeInt::INT; }
 239   virtual uint ideal_reg() const { return Op_RegI; }
 240 
 241 #ifndef PRODUCT
 242   REL_IN_DATA_OUT_1;
 243 #endif
 244 };
 245 
 246 //------------------------------RShiftLNode------------------------------------
 247 // Signed shift right
 248 class RShiftLNode : public Node {
 249 public:
 250   RShiftLNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
 251   virtual int Opcode() const;
 252   virtual Node *Identity( PhaseTransform *phase );
 253   virtual const Type *Value( PhaseTransform *phase ) const;
 254   const Type *bottom_type() const { return TypeLong::LONG; }
 255   virtual uint ideal_reg() const { return Op_RegL; }
 256 
 257 #ifndef PRODUCT
 258   REL_IN_DATA_OUT_1;
 259 #endif
 260 };
 261 
 262 
 263 //------------------------------URShiftINode-----------------------------------
 264 // Logical shift right
 265 class URShiftINode : public Node {
 266 public:
 267   URShiftINode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
 268   virtual int Opcode() const;
 269   virtual Node *Identity( PhaseTransform *phase );
 270   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 271   virtual const Type *Value( PhaseTransform *phase ) const;
 272   const Type *bottom_type() const { return TypeInt::INT; }
 273   virtual uint ideal_reg() const { return Op_RegI; }
 274 
 275 #ifndef PRODUCT
 276   REL_IN_DATA_OUT_1;
 277 #endif
 278 };
 279 
 280 //------------------------------URShiftLNode-----------------------------------
 281 // Logical shift right
 282 class URShiftLNode : public Node {
 283 public:
 284   URShiftLNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {}
 285   virtual int Opcode() const;
 286   virtual Node *Identity( PhaseTransform *phase );
 287   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 288   virtual const Type *Value( PhaseTransform *phase ) const;
 289   const Type *bottom_type() const { return TypeLong::LONG; }
 290   virtual uint ideal_reg() const { return Op_RegL; }
 291 
 292 #ifndef PRODUCT
 293   REL_IN_DATA_OUT_1;
 294 #endif
 295 };
 296 
 297 #endif // SHARE_VM_OPTO_MULNODE_HPP
< prev index next >