1 /*
   2  * Copyright 1997-2007 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *
  23  */
  24 
  25 class PhaseTransform;
  26 class MachNode;
  27 
  28 //------------------------------ConNode----------------------------------------
  29 // Simple constants
  30 class ConNode : public TypeNode {
  31 public:
  32   ConNode( const Type *t ) : TypeNode(t,1) {
  33     init_req(0, (Node*)Compile::current()->root());
  34     init_flags(Flag_is_Con);
  35   }
  36   virtual int  Opcode() const;
  37   virtual uint hash() const;
  38   virtual const RegMask &out_RegMask() const { return RegMask::Empty; }
  39   virtual const RegMask &in_RegMask(uint) const { return RegMask::Empty; }
  40 
  41   // Polymorphic factory method:
  42   static ConNode* make( Compile* C, const Type *t );
  43 };
  44 
  45 //------------------------------ConINode---------------------------------------
  46 // Simple integer constants
  47 class ConINode : public ConNode {
  48 public:
  49   ConINode( const TypeInt *t ) : ConNode(t) {}
  50   virtual int Opcode() const;
  51 
  52   // Factory method:
  53   static ConINode* make( Compile* C, int con ) {
  54     return new (C, 1) ConINode( TypeInt::make(con) );
  55   }
  56 
  57 };
  58 
  59 //------------------------------ConPNode---------------------------------------
  60 // Simple pointer constants
  61 class ConPNode : public ConNode {
  62 public:
  63   ConPNode( const TypePtr *t ) : ConNode(t) {}
  64   virtual int Opcode() const;
  65 
  66   // Factory methods:
  67   static ConPNode* make( Compile *C ,address con ) {
  68     if (con == NULL)
  69       return new (C, 1) ConPNode( TypePtr::NULL_PTR ) ;
  70     else
  71       return new (C, 1) ConPNode( TypeRawPtr::make(con) );
  72   }
  73 };
  74 
  75 
  76 //------------------------------ConNNode--------------------------------------
  77 // Simple narrow oop constants
  78 class ConNNode : public ConNode {
  79 public:
  80   ConNNode( const TypeNarrowOop *t ) : ConNode(t) {}
  81   virtual int Opcode() const;
  82 };
  83 
  84 
  85 //------------------------------ConLNode---------------------------------------
  86 // Simple long constants
  87 class ConLNode : public ConNode {
  88 public:
  89   ConLNode( const TypeLong *t ) : ConNode(t) {}
  90   virtual int Opcode() const;
  91 
  92   // Factory method:
  93   static ConLNode* make( Compile *C ,jlong con ) {
  94     return new (C, 1) ConLNode( TypeLong::make(con) );
  95   }
  96 
  97 };
  98 
  99 //------------------------------ConFNode---------------------------------------
 100 // Simple float constants
 101 class ConFNode : public ConNode {
 102 public:
 103   ConFNode( const TypeF *t ) : ConNode(t) {}
 104   virtual int Opcode() const;
 105 
 106   // Factory method:
 107   static ConFNode* make( Compile *C, float con  ) {
 108     return new (C, 1) ConFNode( TypeF::make(con) );
 109   }
 110 
 111 };
 112 
 113 //------------------------------ConDNode---------------------------------------
 114 // Simple double constants
 115 class ConDNode : public ConNode {
 116 public:
 117   ConDNode( const TypeD *t ) : ConNode(t) {}
 118   virtual int Opcode() const;
 119 
 120   // Factory method:
 121   static ConDNode* make( Compile *C, double con ) {
 122     return new (C, 1) ConDNode( TypeD::make(con) );
 123   }
 124 
 125 };
 126 
 127 //------------------------------BinaryNode-------------------------------------
 128 // Place holder for the 2 conditional inputs to a CMove.  CMove needs 4
 129 // inputs: the Bool (for the lt/gt/eq/ne bits), the flags (result of some
 130 // compare), and the 2 values to select between.  The Matcher requires a
 131 // binary tree so we break it down like this:
 132 //     (CMove (Binary bol cmp) (Binary src1 src2))
 133 class BinaryNode : public Node {
 134 public:
 135   BinaryNode( Node *n1, Node *n2 ) : Node(0,n1,n2) { }
 136   virtual int Opcode() const;
 137   virtual uint ideal_reg() const { return 0; }
 138 };
 139 
 140 //------------------------------CMoveNode--------------------------------------
 141 // Conditional move
 142 class CMoveNode : public TypeNode {
 143 public:
 144   enum { Control,               // When is it safe to do this cmove?
 145          Condition,             // Condition controlling the cmove
 146          IfFalse,               // Value if condition is false
 147          IfTrue };              // Value if condition is true
 148   CMoveNode( Node *bol, Node *left, Node *right, const Type *t ) : TypeNode(t,4)
 149   {
 150     init_class_id(Class_CMove);
 151     // all inputs are nullified in Node::Node(int)
 152     // init_req(Control,NULL);
 153     init_req(Condition,bol);
 154     init_req(IfFalse,left);
 155     init_req(IfTrue,right);
 156   }
 157   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 158   virtual const Type *Value( PhaseTransform *phase ) const;
 159   virtual Node *Identity( PhaseTransform *phase );
 160   static CMoveNode *make( Compile *C, Node *c, Node *bol, Node *left, Node *right, const Type *t );
 161   // Helper function to spot cmove graph shapes
 162   static Node *is_cmove_id( PhaseTransform *phase, Node *cmp, Node *t, Node *f, BoolNode *b );
 163 };
 164 
 165 //------------------------------CMoveDNode-------------------------------------
 166 class CMoveDNode : public CMoveNode {
 167 public:
 168   CMoveDNode( Node *bol, Node *left, Node *right, const Type* t) : CMoveNode(bol,left,right,t){}
 169   virtual int Opcode() const;
 170   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 171 };
 172 
 173 //------------------------------CMoveFNode-------------------------------------
 174 class CMoveFNode : public CMoveNode {
 175 public:
 176   CMoveFNode( Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) {}
 177   virtual int Opcode() const;
 178   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 179 };
 180 
 181 //------------------------------CMoveINode-------------------------------------
 182 class CMoveINode : public CMoveNode {
 183 public:
 184   CMoveINode( Node *bol, Node *left, Node *right, const TypeInt *ti ) : CMoveNode(bol,left,right,ti){}
 185   virtual int Opcode() const;
 186   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 187 };
 188 
 189 //------------------------------CMoveLNode-------------------------------------
 190 class CMoveLNode : public CMoveNode {
 191 public:
 192   CMoveLNode(Node *bol, Node *left, Node *right, const TypeLong *tl ) : CMoveNode(bol,left,right,tl){}
 193   virtual int Opcode() const;
 194 };
 195 
 196 //------------------------------CMovePNode-------------------------------------
 197 class CMovePNode : public CMoveNode {
 198 public:
 199   CMovePNode( Node *c, Node *bol, Node *left, Node *right, const TypePtr* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); }
 200   virtual int Opcode() const;
 201 };
 202 
 203 //------------------------------CMoveNNode-------------------------------------
 204 class CMoveNNode : public CMoveNode {
 205 public:
 206   CMoveNNode( Node *c, Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); }
 207   virtual int Opcode() const;
 208 };
 209 
 210 //------------------------------ConstraintCastNode-----------------------------
 211 // cast to a different range
 212 class ConstraintCastNode: public TypeNode {
 213 public:
 214   ConstraintCastNode (Node *n, const Type *t ): TypeNode(t,2) {
 215     init_class_id(Class_ConstraintCast);
 216     init_req(1, n);
 217   }
 218   virtual Node *Identity( PhaseTransform *phase );
 219   virtual const Type *Value( PhaseTransform *phase ) const;
 220   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 221   virtual int Opcode() const;
 222   virtual uint ideal_reg() const = 0;
 223   virtual Node *Ideal_DU_postCCP( PhaseCCP * );
 224 };
 225 
 226 //------------------------------CastIINode-------------------------------------
 227 // cast integer to integer (different range)
 228 class CastIINode: public ConstraintCastNode {
 229 public:
 230   CastIINode (Node *n, const Type *t ): ConstraintCastNode(n,t) {}
 231   virtual int Opcode() const;
 232   virtual uint ideal_reg() const { return Op_RegI; }
 233 };
 234 
 235 //------------------------------CastPPNode-------------------------------------
 236 // cast pointer to pointer (different type)
 237 class CastPPNode: public ConstraintCastNode {
 238 public:
 239   CastPPNode (Node *n, const Type *t ): ConstraintCastNode(n, t) {}
 240   virtual int Opcode() const;
 241   virtual uint ideal_reg() const { return Op_RegP; }
 242   virtual Node *Ideal_DU_postCCP( PhaseCCP * );
 243 };
 244 
 245 //------------------------------CheckCastPPNode--------------------------------
 246 // for _checkcast, cast pointer to pointer (different type), without JOIN,
 247 class CheckCastPPNode: public TypeNode {
 248 public:
 249   CheckCastPPNode( Node *c, Node *n, const Type *t ) : TypeNode(t,2) {
 250     init_class_id(Class_CheckCastPP);
 251     init_req(0, c);
 252     init_req(1, n);
 253   }
 254 
 255   virtual Node *Identity( PhaseTransform *phase );
 256   virtual const Type *Value( PhaseTransform *phase ) const;
 257   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 258   virtual int   Opcode() const;
 259   virtual uint  ideal_reg() const { return Op_RegP; }
 260   // No longer remove CheckCast after CCP as it gives me a place to hang
 261   // the proper address type - which is required to compute anti-deps.
 262   //virtual Node *Ideal_DU_postCCP( PhaseCCP * );
 263 };
 264 
 265 
 266 //------------------------------EncodeP--------------------------------
 267 // Encodes an oop pointers into its compressed form
 268 // Takes an extra argument which is the real heap base as a long which
 269 // may be useful for code generation in the backend.
 270 class EncodePNode : public TypeNode {
 271  public:
 272   EncodePNode(Node* value, const Type* type):
 273     TypeNode(type, 2) {
 274     init_class_id(Class_EncodeP);
 275     init_req(0, NULL);
 276     init_req(1, value);
 277   }
 278   virtual int Opcode() const;
 279   virtual Node *Identity( PhaseTransform *phase );
 280   virtual const Type *Value( PhaseTransform *phase ) const;
 281   virtual uint  ideal_reg() const { return Op_RegN; }
 282 
 283   static Node* encode(PhaseTransform* phase, Node* value);
 284   virtual Node *Ideal_DU_postCCP( PhaseCCP *ccp );
 285 };
 286 
 287 //------------------------------DecodeN--------------------------------
 288 // Converts a narrow oop into a real oop ptr.
 289 // Takes an extra argument which is the real heap base as a long which
 290 // may be useful for code generation in the backend.
 291 class DecodeNNode : public TypeNode {
 292  public:
 293   DecodeNNode(Node* value, const Type* type):
 294     TypeNode(type, 2) {
 295     init_class_id(Class_DecodeN);
 296     init_req(0, NULL);
 297     init_req(1, value);
 298   }
 299   virtual int Opcode() const;
 300   virtual Node *Identity( PhaseTransform *phase );
 301   virtual const Type *Value( PhaseTransform *phase ) const;
 302   virtual uint  ideal_reg() const { return Op_RegP; }
 303 
 304   static Node* decode(PhaseTransform* phase, Node* value);
 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; }
 327   virtual const Type *Value( PhaseTransform *phase ) const;
 328   virtual Node *Identity( PhaseTransform *phase );
 329   virtual uint  ideal_reg() const { return Op_RegF; }
 330 };
 331 
 332 //------------------------------ConvD2INode------------------------------------
 333 // Convert Double to Integer
 334 class ConvD2INode : public Node {
 335 public:
 336   ConvD2INode( Node *in1 ) : Node(0,in1) {}
 337   virtual int Opcode() const;
 338   virtual const Type *bottom_type() const { return TypeInt::INT; }
 339   virtual const Type *Value( PhaseTransform *phase ) const;
 340   virtual Node *Identity( PhaseTransform *phase );
 341   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 342   virtual uint  ideal_reg() const { return Op_RegI; }
 343 };
 344 
 345 //------------------------------ConvD2LNode------------------------------------
 346 // Convert Double to Long
 347 class ConvD2LNode : public Node {
 348 public:
 349   ConvD2LNode( Node *dbl ) : Node(0,dbl) {}
 350   virtual int Opcode() const;
 351   virtual const Type *bottom_type() const { return TypeLong::LONG; }
 352   virtual const Type *Value( PhaseTransform *phase ) const;
 353   virtual Node *Identity( PhaseTransform *phase );
 354   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 355   virtual uint ideal_reg() const { return Op_RegL; }
 356 };
 357 
 358 //------------------------------ConvF2DNode------------------------------------
 359 // Convert Float to a Double.
 360 class ConvF2DNode : public Node {
 361 public:
 362   ConvF2DNode( Node *in1 ) : Node(0,in1) {}
 363   virtual int Opcode() const;
 364   virtual const Type *bottom_type() const { return Type::DOUBLE; }
 365   virtual const Type *Value( PhaseTransform *phase ) const;
 366   virtual uint  ideal_reg() const { return Op_RegD; }
 367 };
 368 
 369 //------------------------------ConvF2INode------------------------------------
 370 // Convert float to integer
 371 class ConvF2INode : public Node {
 372 public:
 373   ConvF2INode( Node *in1 ) : Node(0,in1) {}
 374   virtual int Opcode() const;
 375   virtual const Type *bottom_type() const { return TypeInt::INT; }
 376   virtual const Type *Value( PhaseTransform *phase ) const;
 377   virtual Node *Identity( PhaseTransform *phase );
 378   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 379   virtual uint  ideal_reg() const { return Op_RegI; }
 380 };
 381 
 382 //------------------------------ConvF2LNode------------------------------------
 383 // Convert float to long
 384 class ConvF2LNode : public Node {
 385 public:
 386   ConvF2LNode( Node *in1 ) : Node(0,in1) {}
 387   virtual int Opcode() const;
 388   virtual const Type *bottom_type() const { return TypeLong::LONG; }
 389   virtual const Type *Value( PhaseTransform *phase ) const;
 390   virtual Node *Identity( PhaseTransform *phase );
 391   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 392   virtual uint  ideal_reg() const { return Op_RegL; }
 393 };
 394 
 395 //------------------------------ConvI2DNode------------------------------------
 396 // Convert Integer to Double
 397 class ConvI2DNode : public Node {
 398 public:
 399   ConvI2DNode( Node *in1 ) : Node(0,in1) {}
 400   virtual int Opcode() const;
 401   virtual const Type *bottom_type() const { return Type::DOUBLE; }
 402   virtual const Type *Value( PhaseTransform *phase ) const;
 403   virtual uint  ideal_reg() const { return Op_RegD; }
 404 };
 405 
 406 //------------------------------ConvI2FNode------------------------------------
 407 // Convert Integer to Float
 408 class ConvI2FNode : public Node {
 409 public:
 410   ConvI2FNode( Node *in1 ) : Node(0,in1) {}
 411   virtual int Opcode() const;
 412   virtual const Type *bottom_type() const { return Type::FLOAT; }
 413   virtual const Type *Value( PhaseTransform *phase ) const;
 414   virtual Node *Identity( PhaseTransform *phase );
 415   virtual uint  ideal_reg() const { return Op_RegF; }
 416 };
 417 
 418 //------------------------------ConvI2LNode------------------------------------
 419 // Convert integer to long
 420 class ConvI2LNode : public TypeNode {
 421 public:
 422   ConvI2LNode(Node *in1, const TypeLong* t = TypeLong::INT)
 423     : TypeNode(t, 2)
 424   { init_req(1, in1); }
 425   virtual int Opcode() const;
 426   virtual const Type *Value( PhaseTransform *phase ) const;
 427   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 428   virtual uint  ideal_reg() const { return Op_RegL; }
 429 };
 430 
 431 //------------------------------ConvL2DNode------------------------------------
 432 // Convert Long to Double
 433 class ConvL2DNode : public Node {
 434 public:
 435   ConvL2DNode( Node *in1 ) : Node(0,in1) {}
 436   virtual int Opcode() const;
 437   virtual const Type *bottom_type() const { return Type::DOUBLE; }
 438   virtual const Type *Value( PhaseTransform *phase ) const;
 439   virtual uint ideal_reg() const { return Op_RegD; }
 440 };
 441 
 442 //------------------------------ConvL2FNode------------------------------------
 443 // Convert Long to Float
 444 class ConvL2FNode : public Node {
 445 public:
 446   ConvL2FNode( Node *in1 ) : Node(0,in1) {}
 447   virtual int Opcode() const;
 448   virtual const Type *bottom_type() const { return Type::FLOAT; }
 449   virtual const Type *Value( PhaseTransform *phase ) const;
 450   virtual uint  ideal_reg() const { return Op_RegF; }
 451 };
 452 
 453 //------------------------------ConvL2INode------------------------------------
 454 // Convert long to integer
 455 class ConvL2INode : public Node {
 456 public:
 457   ConvL2INode( Node *in1 ) : Node(0,in1) {}
 458   virtual int Opcode() const;
 459   virtual const Type *bottom_type() const { return TypeInt::INT; }
 460   virtual Node *Identity( PhaseTransform *phase );
 461   virtual const Type *Value( PhaseTransform *phase ) const;
 462   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 463   virtual uint  ideal_reg() const { return Op_RegI; }
 464 };
 465 
 466 //------------------------------CastX2PNode-------------------------------------
 467 // convert a machine-pointer-sized integer to a raw pointer
 468 class CastX2PNode : public Node {
 469 public:
 470   CastX2PNode( Node *n ) : Node(NULL, n) {}
 471   virtual int Opcode() const;
 472   virtual const Type *Value( PhaseTransform *phase ) const;
 473   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 474   virtual Node *Identity( PhaseTransform *phase );
 475   virtual uint ideal_reg() const { return Op_RegP; }
 476   virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
 477 };
 478 
 479 //------------------------------CastP2XNode-------------------------------------
 480 // Used in both 32-bit and 64-bit land.
 481 // Used for card-marks and unsafe pointer math.
 482 class CastP2XNode : public Node {
 483 public:
 484   CastP2XNode( Node *ctrl, Node *n ) : Node(ctrl, n) {}
 485   virtual int Opcode() const;
 486   virtual const Type *Value( PhaseTransform *phase ) const;
 487   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 488   virtual Node *Identity( PhaseTransform *phase );
 489   virtual uint ideal_reg() const { return Op_RegX; }
 490   virtual const Type *bottom_type() const { return TypeX_X; }
 491   // Return false to keep node from moving away from an associated card mark.
 492   virtual bool depends_only_on_test() const { return false; }
 493 };
 494 
 495 //------------------------------MemMoveNode------------------------------------
 496 // Memory to memory move.  Inserted very late, after allocation.
 497 class MemMoveNode : public Node {
 498 public:
 499   MemMoveNode( Node *dst, Node *src ) : Node(0,dst,src) {}
 500   virtual int Opcode() const;
 501 };
 502 
 503 //------------------------------ThreadLocalNode--------------------------------
 504 // Ideal Node which returns the base of ThreadLocalStorage.
 505 class ThreadLocalNode : public Node {
 506 public:
 507   ThreadLocalNode( ) : Node((Node*)Compile::current()->root()) {}
 508   virtual int Opcode() const;
 509   virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM;}
 510   virtual uint ideal_reg() const { return Op_RegP; }
 511 };
 512 
 513 //------------------------------LoadReturnPCNode-------------------------------
 514 class LoadReturnPCNode: public Node {
 515 public:
 516   LoadReturnPCNode(Node *c) : Node(c) { }
 517   virtual int Opcode() const;
 518   virtual uint ideal_reg() const { return Op_RegP; }
 519 };
 520 
 521 
 522 //-----------------------------RoundFloatNode----------------------------------
 523 class RoundFloatNode: public Node {
 524 public:
 525   RoundFloatNode(Node* c, Node *in1): Node(c, in1) {}
 526   virtual int   Opcode() const;
 527   virtual const Type *bottom_type() const { return Type::FLOAT; }
 528   virtual uint  ideal_reg() const { return Op_RegF; }
 529   virtual Node *Identity( PhaseTransform *phase );
 530   virtual const Type *Value( PhaseTransform *phase ) const;
 531 };
 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:
 608   MoveI2FNode( Node *value ) : Node(0,value) {}
 609   virtual int Opcode() const;
 610   virtual const Type *bottom_type() const { return Type::FLOAT; }
 611   virtual uint ideal_reg() const { return Op_RegF; }
 612   virtual const Type* Value( PhaseTransform *phase ) const;
 613 };
 614 
 615 class MoveL2DNode : public Node {
 616  public:
 617   MoveL2DNode( Node *value ) : Node(0,value) {}
 618   virtual int Opcode() const;
 619   virtual const Type *bottom_type() const { return Type::DOUBLE; }
 620   virtual uint ideal_reg() const { return Op_RegD; }
 621   virtual const Type* Value( PhaseTransform *phase ) const;
 622 };
 623 
 624 class MoveF2INode : public Node {
 625  public:
 626   MoveF2INode( Node *value ) : Node(0,value) {}
 627   virtual int Opcode() const;
 628   virtual const Type *bottom_type() const { return TypeInt::INT; }
 629   virtual uint ideal_reg() const { return Op_RegI; }
 630   virtual const Type* Value( PhaseTransform *phase ) const;
 631 };
 632 
 633 class MoveD2LNode : public Node {
 634  public:
 635   MoveD2LNode( Node *value ) : Node(0,value) {}
 636   virtual int Opcode() const;
 637   virtual const Type *bottom_type() const { return TypeLong::LONG; }
 638   virtual uint ideal_reg() const { return Op_RegL; }
 639   virtual const Type* Value( PhaseTransform *phase ) const;
 640 };