1 /* 2 * Copyright 1997-2009 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 virtual Node *Ideal_DU_postCCP( PhaseCCP *ccp ); 284 }; 285 286 //------------------------------DecodeN-------------------------------- 287 // Converts a narrow oop into a real oop ptr. 288 // Takes an extra argument which is the real heap base as a long which 289 // may be useful for code generation in the backend. 290 class DecodeNNode : public TypeNode { 291 public: 292 DecodeNNode(Node* value, const Type* type): 293 TypeNode(type, 2) { 294 init_class_id(Class_DecodeN); 295 init_req(0, NULL); 296 init_req(1, value); 297 } 298 virtual int Opcode() const; 299 virtual Node *Identity( PhaseTransform *phase ); 300 virtual const Type *Value( PhaseTransform *phase ) const; 301 virtual uint ideal_reg() const { return Op_RegP; } 302 }; 303 304 //------------------------------Conv2BNode------------------------------------- 305 // Convert int/pointer to a Boolean. Map zero to zero, all else to 1. 306 class Conv2BNode : public Node { 307 public: 308 Conv2BNode( Node *i ) : Node(0,i) {} 309 virtual int Opcode() const; 310 virtual const Type *bottom_type() const { return TypeInt::BOOL; } 311 virtual Node *Identity( PhaseTransform *phase ); 312 virtual const Type *Value( PhaseTransform *phase ) const; 313 virtual uint ideal_reg() const { return Op_RegI; } 314 }; 315 316 // The conversions operations are all Alpha sorted. Please keep it that way! 317 //------------------------------ConvD2FNode------------------------------------ 318 // Convert double to float 319 class ConvD2FNode : public Node { 320 public: 321 ConvD2FNode( Node *in1 ) : Node(0,in1) {} 322 virtual int Opcode() const; 323 virtual const Type *bottom_type() const { return Type::FLOAT; } 324 virtual const Type *Value( PhaseTransform *phase ) const; 325 virtual Node *Identity( PhaseTransform *phase ); 326 virtual uint ideal_reg() const { return Op_RegF; } 327 }; 328 329 //------------------------------ConvD2INode------------------------------------ 330 // Convert Double to Integer 331 class ConvD2INode : public Node { 332 public: 333 ConvD2INode( Node *in1 ) : Node(0,in1) {} 334 virtual int Opcode() const; 335 virtual const Type *bottom_type() const { return TypeInt::INT; } 336 virtual const Type *Value( PhaseTransform *phase ) const; 337 virtual Node *Identity( PhaseTransform *phase ); 338 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 339 virtual uint ideal_reg() const { return Op_RegI; } 340 }; 341 342 //------------------------------ConvD2LNode------------------------------------ 343 // Convert Double to Long 344 class ConvD2LNode : public Node { 345 public: 346 ConvD2LNode( Node *dbl ) : Node(0,dbl) {} 347 virtual int Opcode() const; 348 virtual const Type *bottom_type() const { return TypeLong::LONG; } 349 virtual const Type *Value( PhaseTransform *phase ) const; 350 virtual Node *Identity( PhaseTransform *phase ); 351 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 352 virtual uint ideal_reg() const { return Op_RegL; } 353 }; 354 355 //------------------------------ConvF2DNode------------------------------------ 356 // Convert Float to a Double. 357 class ConvF2DNode : public Node { 358 public: 359 ConvF2DNode( Node *in1 ) : Node(0,in1) {} 360 virtual int Opcode() const; 361 virtual const Type *bottom_type() const { return Type::DOUBLE; } 362 virtual const Type *Value( PhaseTransform *phase ) const; 363 virtual uint ideal_reg() const { return Op_RegD; } 364 }; 365 366 //------------------------------ConvF2INode------------------------------------ 367 // Convert float to integer 368 class ConvF2INode : public Node { 369 public: 370 ConvF2INode( Node *in1 ) : Node(0,in1) {} 371 virtual int Opcode() const; 372 virtual const Type *bottom_type() const { return TypeInt::INT; } 373 virtual const Type *Value( PhaseTransform *phase ) const; 374 virtual Node *Identity( PhaseTransform *phase ); 375 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 376 virtual uint ideal_reg() const { return Op_RegI; } 377 }; 378 379 //------------------------------ConvF2LNode------------------------------------ 380 // Convert float to long 381 class ConvF2LNode : public Node { 382 public: 383 ConvF2LNode( Node *in1 ) : Node(0,in1) {} 384 virtual int Opcode() const; 385 virtual const Type *bottom_type() const { return TypeLong::LONG; } 386 virtual const Type *Value( PhaseTransform *phase ) const; 387 virtual Node *Identity( PhaseTransform *phase ); 388 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 389 virtual uint ideal_reg() const { return Op_RegL; } 390 }; 391 392 //------------------------------ConvI2DNode------------------------------------ 393 // Convert Integer to Double 394 class ConvI2DNode : public Node { 395 public: 396 ConvI2DNode( Node *in1 ) : Node(0,in1) {} 397 virtual int Opcode() const; 398 virtual const Type *bottom_type() const { return Type::DOUBLE; } 399 virtual const Type *Value( PhaseTransform *phase ) const; 400 virtual uint ideal_reg() const { return Op_RegD; } 401 }; 402 403 //------------------------------ConvI2FNode------------------------------------ 404 // Convert Integer to Float 405 class ConvI2FNode : public Node { 406 public: 407 ConvI2FNode( Node *in1 ) : Node(0,in1) {} 408 virtual int Opcode() const; 409 virtual const Type *bottom_type() const { return Type::FLOAT; } 410 virtual const Type *Value( PhaseTransform *phase ) const; 411 virtual Node *Identity( PhaseTransform *phase ); 412 virtual uint ideal_reg() const { return Op_RegF; } 413 }; 414 415 //------------------------------ConvI2LNode------------------------------------ 416 // Convert integer to long 417 class ConvI2LNode : public TypeNode { 418 public: 419 ConvI2LNode(Node *in1, const TypeLong* t = TypeLong::INT) 420 : TypeNode(t, 2) 421 { init_req(1, in1); } 422 virtual int Opcode() const; 423 virtual const Type *Value( PhaseTransform *phase ) const; 424 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 425 virtual uint ideal_reg() const { return Op_RegL; } 426 }; 427 428 //------------------------------ConvL2DNode------------------------------------ 429 // Convert Long to Double 430 class ConvL2DNode : public Node { 431 public: 432 ConvL2DNode( Node *in1 ) : Node(0,in1) {} 433 virtual int Opcode() const; 434 virtual const Type *bottom_type() const { return Type::DOUBLE; } 435 virtual const Type *Value( PhaseTransform *phase ) const; 436 virtual uint ideal_reg() const { return Op_RegD; } 437 }; 438 439 //------------------------------ConvL2FNode------------------------------------ 440 // Convert Long to Float 441 class ConvL2FNode : public Node { 442 public: 443 ConvL2FNode( Node *in1 ) : Node(0,in1) {} 444 virtual int Opcode() const; 445 virtual const Type *bottom_type() const { return Type::FLOAT; } 446 virtual const Type *Value( PhaseTransform *phase ) const; 447 virtual uint ideal_reg() const { return Op_RegF; } 448 }; 449 450 //------------------------------ConvL2INode------------------------------------ 451 // Convert long to integer 452 class ConvL2INode : public Node { 453 public: 454 ConvL2INode( Node *in1 ) : Node(0,in1) {} 455 virtual int Opcode() const; 456 virtual const Type *bottom_type() const { return TypeInt::INT; } 457 virtual Node *Identity( PhaseTransform *phase ); 458 virtual const Type *Value( PhaseTransform *phase ) const; 459 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 460 virtual uint ideal_reg() const { return Op_RegI; } 461 }; 462 463 //------------------------------CastX2PNode------------------------------------- 464 // convert a machine-pointer-sized integer to a raw pointer 465 class CastX2PNode : public Node { 466 public: 467 CastX2PNode( Node *n ) : Node(NULL, n) {} 468 virtual int Opcode() const; 469 virtual const Type *Value( PhaseTransform *phase ) const; 470 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 471 virtual Node *Identity( PhaseTransform *phase ); 472 virtual uint ideal_reg() const { return Op_RegP; } 473 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; } 474 }; 475 476 //------------------------------CastP2XNode------------------------------------- 477 // Used in both 32-bit and 64-bit land. 478 // Used for card-marks and unsafe pointer math. 479 class CastP2XNode : public Node { 480 public: 481 CastP2XNode( Node *ctrl, Node *n ) : Node(ctrl, n) {} 482 virtual int Opcode() const; 483 virtual const Type *Value( PhaseTransform *phase ) const; 484 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 485 virtual Node *Identity( PhaseTransform *phase ); 486 virtual uint ideal_reg() const { return Op_RegX; } 487 virtual const Type *bottom_type() const { return TypeX_X; } 488 // Return false to keep node from moving away from an associated card mark. 489 virtual bool depends_only_on_test() const { return false; } 490 }; 491 492 //------------------------------MemMoveNode------------------------------------ 493 // Memory to memory move. Inserted very late, after allocation. 494 class MemMoveNode : public Node { 495 public: 496 MemMoveNode( Node *dst, Node *src ) : Node(0,dst,src) {} 497 virtual int Opcode() const; 498 }; 499 500 //------------------------------ThreadLocalNode-------------------------------- 501 // Ideal Node which returns the base of ThreadLocalStorage. 502 class ThreadLocalNode : public Node { 503 public: 504 ThreadLocalNode( ) : Node((Node*)Compile::current()->root()) {} 505 virtual int Opcode() const; 506 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM;} 507 virtual uint ideal_reg() const { return Op_RegP; } 508 }; 509 510 //------------------------------LoadReturnPCNode------------------------------- 511 class LoadReturnPCNode: public Node { 512 public: 513 LoadReturnPCNode(Node *c) : Node(c) { } 514 virtual int Opcode() const; 515 virtual uint ideal_reg() const { return Op_RegP; } 516 }; 517 518 519 //-----------------------------RoundFloatNode---------------------------------- 520 class RoundFloatNode: public Node { 521 public: 522 RoundFloatNode(Node* c, Node *in1): Node(c, in1) {} 523 virtual int Opcode() const; 524 virtual const Type *bottom_type() const { return Type::FLOAT; } 525 virtual uint ideal_reg() const { return Op_RegF; } 526 virtual Node *Identity( PhaseTransform *phase ); 527 virtual const Type *Value( PhaseTransform *phase ) const; 528 }; 529 530 531 //-----------------------------RoundDoubleNode--------------------------------- 532 class RoundDoubleNode: public Node { 533 public: 534 RoundDoubleNode(Node* c, Node *in1): Node(c, in1) {} 535 virtual int Opcode() const; 536 virtual const Type *bottom_type() const { return Type::DOUBLE; } 537 virtual uint ideal_reg() const { return Op_RegD; } 538 virtual Node *Identity( PhaseTransform *phase ); 539 virtual const Type *Value( PhaseTransform *phase ) const; 540 }; 541 542 //------------------------------Opaque1Node------------------------------------ 543 // A node to prevent unwanted optimizations. Allows constant folding. 544 // Stops value-numbering, Ideal calls or Identity functions. 545 class Opaque1Node : public Node { 546 virtual uint hash() const ; // { return NO_HASH; } 547 virtual uint cmp( const Node &n ) const; 548 public: 549 Opaque1Node( Compile* C, Node *n ) : Node(0,n) { 550 // Put it on the Macro nodes list to removed during macro nodes expansion. 551 init_flags(Flag_is_macro); 552 C->add_macro_node(this); 553 } 554 // Special version for the pre-loop to hold the original loop limit 555 // which is consumed by range check elimination. 556 Opaque1Node( Compile* C, Node *n, Node* orig_limit ) : Node(0,n,orig_limit) { 557 // Put it on the Macro nodes list to removed during macro nodes expansion. 558 init_flags(Flag_is_macro); 559 C->add_macro_node(this); 560 } 561 Node* original_loop_limit() { return req()==3 ? in(2) : NULL; } 562 virtual int Opcode() const; 563 virtual const Type *bottom_type() const { return TypeInt::INT; } 564 virtual Node *Identity( PhaseTransform *phase ); 565 }; 566 567 //------------------------------Opaque2Node------------------------------------ 568 // A node to prevent unwanted optimizations. Allows constant folding. Stops 569 // value-numbering, most Ideal calls or Identity functions. This Node is 570 // specifically designed to prevent the pre-increment value of a loop trip 571 // counter from being live out of the bottom of the loop (hence causing the 572 // pre- and post-increment values both being live and thus requiring an extra 573 // temp register and an extra move). If we "accidentally" optimize through 574 // this kind of a Node, we'll get slightly pessimal, but correct, code. Thus 575 // it's OK to be slightly sloppy on optimizations here. 576 class Opaque2Node : public Node { 577 virtual uint hash() const ; // { return NO_HASH; } 578 virtual uint cmp( const Node &n ) const; 579 public: 580 Opaque2Node( Compile* C, Node *n ) : Node(0,n) { 581 // Put it on the Macro nodes list to removed during macro nodes expansion. 582 init_flags(Flag_is_macro); 583 C->add_macro_node(this); 584 } 585 virtual int Opcode() const; 586 virtual const Type *bottom_type() const { return TypeInt::INT; } 587 }; 588 589 //----------------------PartialSubtypeCheckNode-------------------------------- 590 // The 2nd slow-half of a subtype check. Scan the subklass's 2ndary superklass 591 // array for an instance of the superklass. Set a hidden internal cache on a 592 // hit (cache is checked with exposed code in gen_subtype_check()). Return 593 // not zero for a miss or zero for a hit. 594 class PartialSubtypeCheckNode : public Node { 595 public: 596 PartialSubtypeCheckNode(Node* c, Node* sub, Node* super) : Node(c,sub,super) {} 597 virtual int Opcode() const; 598 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; } 599 virtual uint ideal_reg() const { return Op_RegP; } 600 }; 601 602 // 603 class MoveI2FNode : public Node { 604 public: 605 MoveI2FNode( Node *value ) : Node(0,value) {} 606 virtual int Opcode() const; 607 virtual const Type *bottom_type() const { return Type::FLOAT; } 608 virtual uint ideal_reg() const { return Op_RegF; } 609 virtual const Type* Value( PhaseTransform *phase ) const; 610 }; 611 612 class MoveL2DNode : public Node { 613 public: 614 MoveL2DNode( Node *value ) : Node(0,value) {} 615 virtual int Opcode() const; 616 virtual const Type *bottom_type() const { return Type::DOUBLE; } 617 virtual uint ideal_reg() const { return Op_RegD; } 618 virtual const Type* Value( PhaseTransform *phase ) const; 619 }; 620 621 class MoveF2INode : public Node { 622 public: 623 MoveF2INode( Node *value ) : Node(0,value) {} 624 virtual int Opcode() const; 625 virtual const Type *bottom_type() const { return TypeInt::INT; } 626 virtual uint ideal_reg() const { return Op_RegI; } 627 virtual const Type* Value( PhaseTransform *phase ) const; 628 }; 629 630 class MoveD2LNode : public Node { 631 public: 632 MoveD2LNode( Node *value ) : Node(0,value) {} 633 virtual int Opcode() const; 634 virtual const Type *bottom_type() const { return TypeLong::LONG; } 635 virtual uint ideal_reg() const { return Op_RegL; } 636 virtual const Type* Value( PhaseTransform *phase ) const; 637 }; 638 639 //---------- CountBitsNode ----------------------------------------------------- 640 class CountBitsNode : public Node { 641 public: 642 CountBitsNode(Node* in1) : Node(0, in1) {} 643 const Type* bottom_type() const { return TypeInt::INT; } 644 virtual uint ideal_reg() const { return Op_RegI; } 645 }; 646 647 //---------- CountLeadingZerosINode -------------------------------------------- 648 // Count leading zeros (0-bit count starting from MSB) of an integer. 649 class CountLeadingZerosINode : public CountBitsNode { 650 public: 651 CountLeadingZerosINode(Node* in1) : CountBitsNode(in1) {} 652 virtual int Opcode() const; 653 virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); 654 }; 655 656 //---------- CountLeadingZerosLNode -------------------------------------------- 657 // Count leading zeros (0-bit count starting from MSB) of a long. 658 class CountLeadingZerosLNode : public CountBitsNode { 659 public: 660 CountLeadingZerosLNode(Node* in1) : CountBitsNode(in1) {} 661 virtual int Opcode() const; 662 virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); 663 }; 664 665 //---------- CountTrailingZerosINode ------------------------------------------- 666 // Count trailing zeros (0-bit count starting from LSB) of an integer. 667 class CountTrailingZerosINode : public CountBitsNode { 668 public: 669 CountTrailingZerosINode(Node* in1) : CountBitsNode(in1) {} 670 virtual int Opcode() const; 671 virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); 672 }; 673 674 //---------- CountTrailingZerosLNode ------------------------------------------- 675 // Count trailing zeros (0-bit count starting from LSB) of a long. 676 class CountTrailingZerosLNode : public CountBitsNode { 677 public: 678 CountTrailingZerosLNode(Node* in1) : CountBitsNode(in1) {} 679 virtual int Opcode() const; 680 virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); 681 }; 682 683 //---------- PopCountINode ----------------------------------------------------- 684 // Population count (bit count) of an integer. 685 class PopCountINode : public CountBitsNode { 686 public: 687 PopCountINode(Node* in1) : CountBitsNode(in1) {} 688 virtual int Opcode() const; 689 }; 690 691 //---------- PopCountLNode ----------------------------------------------------- 692 // Population count (bit count) of a long. 693 class PopCountLNode : public CountBitsNode { 694 public: 695 PopCountLNode(Node* in1) : CountBitsNode(in1) {} 696 virtual int Opcode() const; 697 };