hotspot/src/share/vm/opto/connode.hpp

Print this page
rev 611 : Merge
   1 #ifdef USE_PRAGMA_IDENT_HDR
   2 #pragma ident "@(#)connode.hpp  1.160 07/05/05 17:06:13 JVM"
   3 #endif
   4 /*
   5  * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
   6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7  *
   8  * This code is free software; you can redistribute it and/or modify it
   9  * under the terms of the GNU General Public License version 2 only, as
  10  * published by the Free Software Foundation.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  23  * CA 95054 USA or visit www.sun.com if you need additional information or
  24  * have any questions.
  25  *  


  56   static ConINode* make( Compile* C, int con ) {
  57     return new (C, 1) ConINode( TypeInt::make(con) );
  58   }
  59 
  60 };
  61 
  62 //------------------------------ConPNode---------------------------------------
  63 // Simple pointer constants
  64 class ConPNode : public ConNode {
  65 public:
  66   ConPNode( const TypePtr *t ) : ConNode(t) {}
  67   virtual int Opcode() const;
  68 
  69   // Factory methods:
  70   static ConPNode* make( Compile *C ,address con ) {
  71     if (con == NULL)
  72       return new (C, 1) ConPNode( TypePtr::NULL_PTR ) ;
  73     else
  74       return new (C, 1) ConPNode( TypeRawPtr::make(con) );
  75   }

  76 
  77   static ConPNode* make( Compile *C, ciObject* con ) {
  78     return new (C, 1) ConPNode( TypeOopPtr::make_from_constant(con) );
  79   }
  80 






  81 };
  82 
  83 
  84 //------------------------------ConLNode---------------------------------------
  85 // Simple long constants
  86 class ConLNode : public ConNode {
  87 public:
  88   ConLNode( const TypeLong *t ) : ConNode(t) {}
  89   virtual int Opcode() const;
  90 
  91   // Factory method:
  92   static ConLNode* make( Compile *C ,jlong con ) {
  93     return new (C, 1) ConLNode( TypeLong::make(con) );
  94   }
  95 
  96 };
  97 
  98 //------------------------------ConFNode---------------------------------------
  99 // Simple float constants
 100 class ConFNode : public ConNode {


 182 public:
 183   CMoveINode( Node *bol, Node *left, Node *right, const TypeInt *ti ) : CMoveNode(bol,left,right,ti){}
 184   virtual int Opcode() const;
 185   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 186 };
 187 
 188 //------------------------------CMoveLNode-------------------------------------
 189 class CMoveLNode : public CMoveNode {
 190 public:
 191   CMoveLNode(Node *bol, Node *left, Node *right, const TypeLong *tl ) : CMoveNode(bol,left,right,tl){}
 192   virtual int Opcode() const;
 193 };
 194 
 195 //------------------------------CMovePNode-------------------------------------
 196 class CMovePNode : public CMoveNode {
 197 public:
 198   CMovePNode( Node *c, Node *bol, Node *left, Node *right, const TypePtr* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); }
 199   virtual int Opcode() const;
 200 };
 201 
 202 //------------------------------ConstraintCastNode-------------------------------------







 203 // cast to a different range
 204 class ConstraintCastNode: public TypeNode {
 205 public:
 206   ConstraintCastNode (Node *n, const Type *t ): TypeNode(t,2) {
 207     init_class_id(Class_ConstraintCast);
 208     init_req(1, n);
 209   }
 210   virtual Node *Identity( PhaseTransform *phase );
 211   virtual const Type *Value( PhaseTransform *phase ) const;
 212   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 213   virtual int Opcode() const;
 214   virtual uint ideal_reg() const = 0;
 215   virtual Node *Ideal_DU_postCCP( PhaseCCP * );
 216 };
 217 
 218 //------------------------------CastIINode-------------------------------------
 219 // cast integer to integer (different range)
 220 class CastIINode: public ConstraintCastNode {
 221 public:
 222   CastIINode (Node *n, const Type *t ): ConstraintCastNode(n,t) {}
 223   virtual int Opcode() const;
 224   virtual uint ideal_reg() const { return Op_RegI; }
 225 };
 226 
 227 //------------------------------CastPPNode-------------------------------------
 228 // cast pointer to pointer (different type)
 229 class CastPPNode: public ConstraintCastNode {
 230 public:
 231   CastPPNode (Node *n, const Type *t ): ConstraintCastNode(n, t) {
 232     // Only CastPP is safe.  CastII can cause optimizer loops.
 233     init_flags(Flag_is_dead_loop_safe);
 234   }
 235   virtual int Opcode() const;
 236   virtual uint ideal_reg() const { return Op_RegP; }
 237   virtual Node *Ideal_DU_postCCP( PhaseCCP * );
 238 };
 239 
 240 //------------------------------CheckCastPPNode--------------------------------
 241 // for _checkcast, cast pointer to pointer (different type), without JOIN,
 242 class CheckCastPPNode: public TypeNode {
 243 public:
 244   CheckCastPPNode( Node *c, Node *n, const Type *t ) : TypeNode(t,2) {
 245     init_class_id(Class_CheckCastPP);
 246     init_flags(Flag_is_dead_loop_safe);
 247     init_req(0, c);
 248     init_req(1, n);
 249   }

 250   virtual Node *Identity( PhaseTransform *phase );
 251   virtual const Type *Value( PhaseTransform *phase ) const;
 252   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 253   virtual int   Opcode() const;
 254   virtual uint  ideal_reg() const { return Op_RegP; }
 255   // No longer remove CheckCast after CCP as it gives me a place to hang
 256   // the proper address type - which is required to compute anti-deps.
 257   //virtual Node *Ideal_DU_postCCP( PhaseCCP * );
 258 };
 259 







































 260 //------------------------------Conv2BNode-------------------------------------
 261 // Convert int/pointer to a Boolean.  Map zero to zero, all else to 1.
 262 class Conv2BNode : public Node {
 263 public:
 264   Conv2BNode( Node *i ) : Node(0,i) {}
 265   virtual int Opcode() const;
 266   virtual const Type *bottom_type() const { return TypeInt::BOOL; }
 267   virtual Node *Identity( PhaseTransform *phase );
 268   virtual const Type *Value( PhaseTransform *phase ) const;
 269   virtual uint  ideal_reg() const { return Op_RegI; }
 270 };
 271 
 272 // The conversions operations are all Alpha sorted.  Please keep it that way!
 273 //------------------------------ConvD2FNode------------------------------------
 274 // Convert double to float
 275 class ConvD2FNode : public Node {
 276 public:
 277   ConvD2FNode( Node *in1 ) : Node(0,in1) {}
 278   virtual int Opcode() const;
 279   virtual const Type *bottom_type() const { return Type::FLOAT; }


 485 
 486 
 487 //-----------------------------RoundDoubleNode---------------------------------
 488 class RoundDoubleNode: public Node {
 489 public:
 490   RoundDoubleNode(Node* c, Node *in1): Node(c, in1) {}
 491   virtual int   Opcode() const;
 492   virtual const Type *bottom_type() const { return Type::DOUBLE; }
 493   virtual uint  ideal_reg() const { return Op_RegD; }
 494   virtual Node *Identity( PhaseTransform *phase );
 495   virtual const Type *Value( PhaseTransform *phase ) const;
 496 };
 497 
 498 //------------------------------Opaque1Node------------------------------------
 499 // A node to prevent unwanted optimizations.  Allows constant folding.
 500 // Stops value-numbering, Ideal calls or Identity functions.
 501 class Opaque1Node : public Node {
 502   virtual uint hash() const ;                  // { return NO_HASH; }
 503   virtual uint cmp( const Node &n ) const;
 504 public:
 505   Opaque1Node( Node *n ) : Node(0,n) {}




 506   // Special version for the pre-loop to hold the original loop limit
 507   // which is consumed by range check elimination.
 508   Opaque1Node( Node *n, Node* orig_limit ) : Node(0,n,orig_limit) {}




 509   Node* original_loop_limit() { return req()==3 ? in(2) : NULL; }
 510   virtual int Opcode() const;
 511   virtual const Type *bottom_type() const { return TypeInt::INT; }
 512   virtual Node *Identity( PhaseTransform *phase );
 513 };
 514 
 515 //------------------------------Opaque2Node------------------------------------
 516 // A node to prevent unwanted optimizations.  Allows constant folding.  Stops
 517 // value-numbering, most Ideal calls or Identity functions.  This Node is
 518 // specifically designed to prevent the pre-increment value of a loop trip
 519 // counter from being live out of the bottom of the loop (hence causing the
 520 // pre- and post-increment values both being live and thus requiring an extra
 521 // temp register and an extra move).  If we "accidentally" optimize through
 522 // this kind of a Node, we'll get slightly pessimal, but correct, code.  Thus
 523 // it's OK to be slightly sloppy on optimizations here.
 524 class Opaque2Node : public Node {
 525   virtual uint hash() const ;                  // { return NO_HASH; }
 526   virtual uint cmp( const Node &n ) const;
 527 public:
 528   Opaque2Node( Node *n ) : Node(0,n) {}




 529   virtual int Opcode() const;
 530   virtual const Type *bottom_type() const { return TypeInt::INT; }
 531 };
 532 
 533 //----------------------PartialSubtypeCheckNode--------------------------------
 534 // The 2nd slow-half of a subtype check.  Scan the subklass's 2ndary superklass
 535 // array for an instance of the superklass.  Set a hidden internal cache on a
 536 // hit (cache is checked with exposed code in gen_subtype_check()).  Return
 537 // not zero for a miss or zero for a hit.  
 538 class PartialSubtypeCheckNode : public Node {
 539 public:
 540   PartialSubtypeCheckNode(Node* c, Node* sub, Node* super) : Node(c,sub,super) {}
 541   virtual int Opcode() const;
 542   virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
 543   virtual uint ideal_reg() const { return Op_RegP; }
 544 };
 545 
 546 // 
 547 class MoveI2FNode : public Node {
 548  public:


   1 #ifdef USE_PRAGMA_IDENT_HDR
   2 #pragma ident "@(#)connode.hpp  1.160 07/05/05 17:06:13 JVM"
   3 #endif
   4 /*
   5  * Copyright 1997-2008 Sun Microsystems, Inc.  All Rights Reserved.
   6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7  *
   8  * This code is free software; you can redistribute it and/or modify it
   9  * under the terms of the GNU General Public License version 2 only, as
  10  * published by the Free Software Foundation.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  23  * CA 95054 USA or visit www.sun.com if you need additional information or
  24  * have any questions.
  25  *  


  56   static ConINode* make( Compile* C, int con ) {
  57     return new (C, 1) ConINode( TypeInt::make(con) );
  58   }
  59 
  60 };
  61 
  62 //------------------------------ConPNode---------------------------------------
  63 // Simple pointer constants
  64 class ConPNode : public ConNode {
  65 public:
  66   ConPNode( const TypePtr *t ) : ConNode(t) {}
  67   virtual int Opcode() const;
  68 
  69   // Factory methods:
  70   static ConPNode* make( Compile *C ,address con ) {
  71     if (con == NULL)
  72       return new (C, 1) ConPNode( TypePtr::NULL_PTR ) ;
  73     else
  74       return new (C, 1) ConPNode( TypeRawPtr::make(con) );
  75   }
  76 };
  77 



  78 
  79 //------------------------------ConNNode--------------------------------------
  80 // Simple narrow oop constants
  81 class ConNNode : public ConNode {
  82 public:
  83   ConNNode( const TypeNarrowOop *t ) : ConNode(t) {}
  84   virtual int Opcode() const;
  85 };
  86 
  87 
  88 //------------------------------ConLNode---------------------------------------
  89 // Simple long constants
  90 class ConLNode : public ConNode {
  91 public:
  92   ConLNode( const TypeLong *t ) : ConNode(t) {}
  93   virtual int Opcode() const;
  94 
  95   // Factory method:
  96   static ConLNode* make( Compile *C ,jlong con ) {
  97     return new (C, 1) ConLNode( TypeLong::make(con) );
  98   }
  99 
 100 };
 101 
 102 //------------------------------ConFNode---------------------------------------
 103 // Simple float constants
 104 class ConFNode : public ConNode {


 186 public:
 187   CMoveINode( Node *bol, Node *left, Node *right, const TypeInt *ti ) : CMoveNode(bol,left,right,ti){}
 188   virtual int Opcode() const;
 189   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 190 };
 191 
 192 //------------------------------CMoveLNode-------------------------------------
 193 class CMoveLNode : public CMoveNode {
 194 public:
 195   CMoveLNode(Node *bol, Node *left, Node *right, const TypeLong *tl ) : CMoveNode(bol,left,right,tl){}
 196   virtual int Opcode() const;
 197 };
 198 
 199 //------------------------------CMovePNode-------------------------------------
 200 class CMovePNode : public CMoveNode {
 201 public:
 202   CMovePNode( Node *c, Node *bol, Node *left, Node *right, const TypePtr* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); }
 203   virtual int Opcode() const;
 204 };
 205 
 206 //------------------------------CMoveNNode-------------------------------------
 207 class CMoveNNode : public CMoveNode {
 208 public:
 209   CMoveNNode( Node *c, Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); }
 210   virtual int Opcode() const;
 211 };
 212 
 213 //------------------------------ConstraintCastNode-----------------------------
 214 // cast to a different range
 215 class ConstraintCastNode: public TypeNode {
 216 public:
 217   ConstraintCastNode (Node *n, const Type *t ): TypeNode(t,2) {
 218     init_class_id(Class_ConstraintCast);
 219     init_req(1, n);
 220   }
 221   virtual Node *Identity( PhaseTransform *phase );
 222   virtual const Type *Value( PhaseTransform *phase ) const;
 223   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 224   virtual int Opcode() const;
 225   virtual uint ideal_reg() const = 0;
 226   virtual Node *Ideal_DU_postCCP( PhaseCCP * );
 227 };
 228 
 229 //------------------------------CastIINode-------------------------------------
 230 // cast integer to integer (different range)
 231 class CastIINode: public ConstraintCastNode {
 232 public:
 233   CastIINode (Node *n, const Type *t ): ConstraintCastNode(n,t) {}
 234   virtual int Opcode() const;
 235   virtual uint ideal_reg() const { return Op_RegI; }
 236 };
 237 
 238 //------------------------------CastPPNode-------------------------------------
 239 // cast pointer to pointer (different type)
 240 class CastPPNode: public ConstraintCastNode {
 241 public:
 242   CastPPNode (Node *n, const Type *t ): ConstraintCastNode(n, t) {}



 243   virtual int Opcode() const;
 244   virtual uint ideal_reg() const { return Op_RegP; }
 245   virtual Node *Ideal_DU_postCCP( PhaseCCP * );
 246 };
 247 
 248 //------------------------------CheckCastPPNode--------------------------------
 249 // for _checkcast, cast pointer to pointer (different type), without JOIN,
 250 class CheckCastPPNode: public TypeNode {
 251 public:
 252   CheckCastPPNode( Node *c, Node *n, const Type *t ) : TypeNode(t,2) {
 253     init_class_id(Class_CheckCastPP);

 254     init_req(0, c);
 255     init_req(1, n);
 256   }
 257 
 258   virtual Node *Identity( PhaseTransform *phase );
 259   virtual const Type *Value( PhaseTransform *phase ) const;
 260   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 261   virtual int   Opcode() const;
 262   virtual uint  ideal_reg() const { return Op_RegP; }
 263   // No longer remove CheckCast after CCP as it gives me a place to hang
 264   // the proper address type - which is required to compute anti-deps.
 265   //virtual Node *Ideal_DU_postCCP( PhaseCCP * );
 266 };
 267 
 268 
 269 //------------------------------EncodeP--------------------------------
 270 // Encodes an oop pointers into its compressed form
 271 // Takes an extra argument which is the real heap base as a long which
 272 // may be useful for code generation in the backend.
 273 class EncodePNode : public TypeNode {
 274  public:
 275   EncodePNode(Node* value, const Type* type):
 276     TypeNode(type, 2) {
 277     init_class_id(Class_EncodeP);
 278     init_req(0, NULL);
 279     init_req(1, value);
 280   }
 281   virtual int Opcode() const;
 282   virtual Node *Identity( PhaseTransform *phase );
 283   virtual const Type *Value( PhaseTransform *phase ) const;
 284   virtual uint  ideal_reg() const { return Op_RegN; }
 285 
 286   virtual Node *Ideal_DU_postCCP( PhaseCCP *ccp );
 287 };
 288 
 289 //------------------------------DecodeN--------------------------------
 290 // Converts a narrow oop into a real oop ptr.
 291 // Takes an extra argument which is the real heap base as a long which
 292 // may be useful for code generation in the backend.
 293 class DecodeNNode : public TypeNode {
 294  public:
 295   DecodeNNode(Node* value, const Type* type):
 296     TypeNode(type, 2) {
 297     init_class_id(Class_DecodeN);
 298     init_req(0, NULL);
 299     init_req(1, value);
 300   }
 301   virtual int Opcode() const;
 302   virtual Node *Identity( PhaseTransform *phase );
 303   virtual const Type *Value( PhaseTransform *phase ) const;
 304   virtual uint  ideal_reg() const { return Op_RegP; }
 305 };
 306 
 307 //------------------------------Conv2BNode-------------------------------------
 308 // Convert int/pointer to a Boolean.  Map zero to zero, all else to 1.
 309 class Conv2BNode : public Node {
 310 public:
 311   Conv2BNode( Node *i ) : Node(0,i) {}
 312   virtual int Opcode() const;
 313   virtual const Type *bottom_type() const { return TypeInt::BOOL; }
 314   virtual Node *Identity( PhaseTransform *phase );
 315   virtual const Type *Value( PhaseTransform *phase ) const;
 316   virtual uint  ideal_reg() const { return Op_RegI; }
 317 };
 318 
 319 // The conversions operations are all Alpha sorted.  Please keep it that way!
 320 //------------------------------ConvD2FNode------------------------------------
 321 // Convert double to float
 322 class ConvD2FNode : public Node {
 323 public:
 324   ConvD2FNode( Node *in1 ) : Node(0,in1) {}
 325   virtual int Opcode() const;
 326   virtual const Type *bottom_type() const { return Type::FLOAT; }


 532 
 533 
 534 //-----------------------------RoundDoubleNode---------------------------------
 535 class RoundDoubleNode: public Node {
 536 public:
 537   RoundDoubleNode(Node* c, Node *in1): Node(c, in1) {}
 538   virtual int   Opcode() const;
 539   virtual const Type *bottom_type() const { return Type::DOUBLE; }
 540   virtual uint  ideal_reg() const { return Op_RegD; }
 541   virtual Node *Identity( PhaseTransform *phase );
 542   virtual const Type *Value( PhaseTransform *phase ) const;
 543 };
 544 
 545 //------------------------------Opaque1Node------------------------------------
 546 // A node to prevent unwanted optimizations.  Allows constant folding.
 547 // Stops value-numbering, Ideal calls or Identity functions.
 548 class Opaque1Node : public Node {
 549   virtual uint hash() const ;                  // { return NO_HASH; }
 550   virtual uint cmp( const Node &n ) const;
 551 public:
 552   Opaque1Node( Compile* C, Node *n ) : Node(0,n) {
 553     // Put it on the Macro nodes list to removed during macro nodes expansion.
 554     init_flags(Flag_is_macro);
 555     C->add_macro_node(this);
 556   }
 557   // Special version for the pre-loop to hold the original loop limit
 558   // which is consumed by range check elimination.
 559   Opaque1Node( Compile* C, Node *n, Node* orig_limit ) : Node(0,n,orig_limit) {
 560     // Put it on the Macro nodes list to removed during macro nodes expansion.
 561     init_flags(Flag_is_macro);
 562     C->add_macro_node(this);
 563   }
 564   Node* original_loop_limit() { return req()==3 ? in(2) : NULL; }
 565   virtual int Opcode() const;
 566   virtual const Type *bottom_type() const { return TypeInt::INT; }
 567   virtual Node *Identity( PhaseTransform *phase );
 568 };
 569 
 570 //------------------------------Opaque2Node------------------------------------
 571 // A node to prevent unwanted optimizations.  Allows constant folding.  Stops
 572 // value-numbering, most Ideal calls or Identity functions.  This Node is
 573 // specifically designed to prevent the pre-increment value of a loop trip
 574 // counter from being live out of the bottom of the loop (hence causing the
 575 // pre- and post-increment values both being live and thus requiring an extra
 576 // temp register and an extra move).  If we "accidentally" optimize through
 577 // this kind of a Node, we'll get slightly pessimal, but correct, code.  Thus
 578 // it's OK to be slightly sloppy on optimizations here.
 579 class Opaque2Node : public Node {
 580   virtual uint hash() const ;                  // { return NO_HASH; }
 581   virtual uint cmp( const Node &n ) const;
 582 public:
 583   Opaque2Node( Compile* C, Node *n ) : Node(0,n) {
 584     // Put it on the Macro nodes list to removed during macro nodes expansion.
 585     init_flags(Flag_is_macro);
 586     C->add_macro_node(this);
 587   }
 588   virtual int Opcode() const;
 589   virtual const Type *bottom_type() const { return TypeInt::INT; }
 590 };
 591 
 592 //----------------------PartialSubtypeCheckNode--------------------------------
 593 // The 2nd slow-half of a subtype check.  Scan the subklass's 2ndary superklass
 594 // array for an instance of the superklass.  Set a hidden internal cache on a
 595 // hit (cache is checked with exposed code in gen_subtype_check()).  Return
 596 // not zero for a miss or zero for a hit.  
 597 class PartialSubtypeCheckNode : public Node {
 598 public:
 599   PartialSubtypeCheckNode(Node* c, Node* sub, Node* super) : Node(c,sub,super) {}
 600   virtual int Opcode() const;
 601   virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
 602   virtual uint ideal_reg() const { return Op_RegP; }
 603 };
 604 
 605 // 
 606 class MoveI2FNode : public Node {
 607  public: