annotate src/share/vm/opto/connode.hpp @ 747:93c14e5562c4

6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}() Summary: These methods can be instrinsified by using bit scan, bit test, and population count instructions. Reviewed-by: kvn, never
author twisti
date Wed, 06 May 2009 00:27:52 -0700
parents c771b7f43bbf
children c18cbe5936b8
rev   line source
duke@0 1 /*
twisti@620 2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
duke@0 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 21 * have any questions.
duke@0 22 *
duke@0 23 */
duke@0 24
duke@0 25 class PhaseTransform;
duke@0 26 class MachNode;
duke@0 27
duke@0 28 //------------------------------ConNode----------------------------------------
duke@0 29 // Simple constants
duke@0 30 class ConNode : public TypeNode {
duke@0 31 public:
duke@0 32 ConNode( const Type *t ) : TypeNode(t,1) {
duke@0 33 init_req(0, (Node*)Compile::current()->root());
duke@0 34 init_flags(Flag_is_Con);
duke@0 35 }
duke@0 36 virtual int Opcode() const;
duke@0 37 virtual uint hash() const;
duke@0 38 virtual const RegMask &out_RegMask() const { return RegMask::Empty; }
duke@0 39 virtual const RegMask &in_RegMask(uint) const { return RegMask::Empty; }
duke@0 40
duke@0 41 // Polymorphic factory method:
duke@0 42 static ConNode* make( Compile* C, const Type *t );
duke@0 43 };
duke@0 44
duke@0 45 //------------------------------ConINode---------------------------------------
duke@0 46 // Simple integer constants
duke@0 47 class ConINode : public ConNode {
duke@0 48 public:
duke@0 49 ConINode( const TypeInt *t ) : ConNode(t) {}
duke@0 50 virtual int Opcode() const;
duke@0 51
duke@0 52 // Factory method:
duke@0 53 static ConINode* make( Compile* C, int con ) {
duke@0 54 return new (C, 1) ConINode( TypeInt::make(con) );
duke@0 55 }
duke@0 56
duke@0 57 };
duke@0 58
duke@0 59 //------------------------------ConPNode---------------------------------------
duke@0 60 // Simple pointer constants
duke@0 61 class ConPNode : public ConNode {
duke@0 62 public:
duke@0 63 ConPNode( const TypePtr *t ) : ConNode(t) {}
duke@0 64 virtual int Opcode() const;
duke@0 65
duke@0 66 // Factory methods:
duke@0 67 static ConPNode* make( Compile *C ,address con ) {
duke@0 68 if (con == NULL)
duke@0 69 return new (C, 1) ConPNode( TypePtr::NULL_PTR ) ;
duke@0 70 else
duke@0 71 return new (C, 1) ConPNode( TypeRawPtr::make(con) );
duke@0 72 }
duke@0 73 };
duke@0 74
duke@0 75
coleenp@108 76 //------------------------------ConNNode--------------------------------------
coleenp@108 77 // Simple narrow oop constants
coleenp@108 78 class ConNNode : public ConNode {
coleenp@108 79 public:
coleenp@108 80 ConNNode( const TypeNarrowOop *t ) : ConNode(t) {}
coleenp@108 81 virtual int Opcode() const;
coleenp@108 82 };
coleenp@108 83
coleenp@108 84
duke@0 85 //------------------------------ConLNode---------------------------------------
duke@0 86 // Simple long constants
duke@0 87 class ConLNode : public ConNode {
duke@0 88 public:
duke@0 89 ConLNode( const TypeLong *t ) : ConNode(t) {}
duke@0 90 virtual int Opcode() const;
duke@0 91
duke@0 92 // Factory method:
duke@0 93 static ConLNode* make( Compile *C ,jlong con ) {
duke@0 94 return new (C, 1) ConLNode( TypeLong::make(con) );
duke@0 95 }
duke@0 96
duke@0 97 };
duke@0 98
duke@0 99 //------------------------------ConFNode---------------------------------------
duke@0 100 // Simple float constants
duke@0 101 class ConFNode : public ConNode {
duke@0 102 public:
duke@0 103 ConFNode( const TypeF *t ) : ConNode(t) {}
duke@0 104 virtual int Opcode() const;
duke@0 105
duke@0 106 // Factory method:
duke@0 107 static ConFNode* make( Compile *C, float con ) {
duke@0 108 return new (C, 1) ConFNode( TypeF::make(con) );
duke@0 109 }
duke@0 110
duke@0 111 };
duke@0 112
duke@0 113 //------------------------------ConDNode---------------------------------------
duke@0 114 // Simple double constants
duke@0 115 class ConDNode : public ConNode {
duke@0 116 public:
duke@0 117 ConDNode( const TypeD *t ) : ConNode(t) {}
duke@0 118 virtual int Opcode() const;
duke@0 119
duke@0 120 // Factory method:
duke@0 121 static ConDNode* make( Compile *C, double con ) {
duke@0 122 return new (C, 1) ConDNode( TypeD::make(con) );
duke@0 123 }
duke@0 124
duke@0 125 };
duke@0 126
duke@0 127 //------------------------------BinaryNode-------------------------------------
duke@0 128 // Place holder for the 2 conditional inputs to a CMove. CMove needs 4
duke@0 129 // inputs: the Bool (for the lt/gt/eq/ne bits), the flags (result of some
duke@0 130 // compare), and the 2 values to select between. The Matcher requires a
duke@0 131 // binary tree so we break it down like this:
duke@0 132 // (CMove (Binary bol cmp) (Binary src1 src2))
duke@0 133 class BinaryNode : public Node {
duke@0 134 public:
duke@0 135 BinaryNode( Node *n1, Node *n2 ) : Node(0,n1,n2) { }
duke@0 136 virtual int Opcode() const;
duke@0 137 virtual uint ideal_reg() const { return 0; }
duke@0 138 };
duke@0 139
duke@0 140 //------------------------------CMoveNode--------------------------------------
duke@0 141 // Conditional move
duke@0 142 class CMoveNode : public TypeNode {
duke@0 143 public:
duke@0 144 enum { Control, // When is it safe to do this cmove?
duke@0 145 Condition, // Condition controlling the cmove
duke@0 146 IfFalse, // Value if condition is false
duke@0 147 IfTrue }; // Value if condition is true
duke@0 148 CMoveNode( Node *bol, Node *left, Node *right, const Type *t ) : TypeNode(t,4)
duke@0 149 {
duke@0 150 init_class_id(Class_CMove);
duke@0 151 // all inputs are nullified in Node::Node(int)
duke@0 152 // init_req(Control,NULL);
duke@0 153 init_req(Condition,bol);
duke@0 154 init_req(IfFalse,left);
duke@0 155 init_req(IfTrue,right);
duke@0 156 }
duke@0 157 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 158 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 159 virtual Node *Identity( PhaseTransform *phase );
duke@0 160 static CMoveNode *make( Compile *C, Node *c, Node *bol, Node *left, Node *right, const Type *t );
duke@0 161 // Helper function to spot cmove graph shapes
duke@0 162 static Node *is_cmove_id( PhaseTransform *phase, Node *cmp, Node *t, Node *f, BoolNode *b );
duke@0 163 };
duke@0 164
duke@0 165 //------------------------------CMoveDNode-------------------------------------
duke@0 166 class CMoveDNode : public CMoveNode {
duke@0 167 public:
duke@0 168 CMoveDNode( Node *bol, Node *left, Node *right, const Type* t) : CMoveNode(bol,left,right,t){}
duke@0 169 virtual int Opcode() const;
duke@0 170 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 171 };
duke@0 172
duke@0 173 //------------------------------CMoveFNode-------------------------------------
duke@0 174 class CMoveFNode : public CMoveNode {
duke@0 175 public:
duke@0 176 CMoveFNode( Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) {}
duke@0 177 virtual int Opcode() const;
duke@0 178 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 179 };
duke@0 180
duke@0 181 //------------------------------CMoveINode-------------------------------------
duke@0 182 class CMoveINode : public CMoveNode {
duke@0 183 public:
duke@0 184 CMoveINode( Node *bol, Node *left, Node *right, const TypeInt *ti ) : CMoveNode(bol,left,right,ti){}
duke@0 185 virtual int Opcode() const;
duke@0 186 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 187 };
duke@0 188
duke@0 189 //------------------------------CMoveLNode-------------------------------------
duke@0 190 class CMoveLNode : public CMoveNode {
duke@0 191 public:
duke@0 192 CMoveLNode(Node *bol, Node *left, Node *right, const TypeLong *tl ) : CMoveNode(bol,left,right,tl){}
duke@0 193 virtual int Opcode() const;
duke@0 194 };
duke@0 195
duke@0 196 //------------------------------CMovePNode-------------------------------------
duke@0 197 class CMovePNode : public CMoveNode {
duke@0 198 public:
duke@0 199 CMovePNode( Node *c, Node *bol, Node *left, Node *right, const TypePtr* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); }
duke@0 200 virtual int Opcode() const;
duke@0 201 };
duke@0 202
kvn@152 203 //------------------------------CMoveNNode-------------------------------------
kvn@152 204 class CMoveNNode : public CMoveNode {
kvn@152 205 public:
kvn@152 206 CMoveNNode( Node *c, Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); }
kvn@152 207 virtual int Opcode() const;
kvn@152 208 };
kvn@152 209
kvn@152 210 //------------------------------ConstraintCastNode-----------------------------
duke@0 211 // cast to a different range
duke@0 212 class ConstraintCastNode: public TypeNode {
duke@0 213 public:
duke@0 214 ConstraintCastNode (Node *n, const Type *t ): TypeNode(t,2) {
duke@0 215 init_class_id(Class_ConstraintCast);
duke@0 216 init_req(1, n);
duke@0 217 }
duke@0 218 virtual Node *Identity( PhaseTransform *phase );
duke@0 219 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 220 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 221 virtual int Opcode() const;
duke@0 222 virtual uint ideal_reg() const = 0;
duke@0 223 virtual Node *Ideal_DU_postCCP( PhaseCCP * );
duke@0 224 };
duke@0 225
duke@0 226 //------------------------------CastIINode-------------------------------------
duke@0 227 // cast integer to integer (different range)
duke@0 228 class CastIINode: public ConstraintCastNode {
duke@0 229 public:
duke@0 230 CastIINode (Node *n, const Type *t ): ConstraintCastNode(n,t) {}
duke@0 231 virtual int Opcode() const;
duke@0 232 virtual uint ideal_reg() const { return Op_RegI; }
duke@0 233 };
duke@0 234
duke@0 235 //------------------------------CastPPNode-------------------------------------
duke@0 236 // cast pointer to pointer (different type)
duke@0 237 class CastPPNode: public ConstraintCastNode {
duke@0 238 public:
kvn@115 239 CastPPNode (Node *n, const Type *t ): ConstraintCastNode(n, t) {}
duke@0 240 virtual int Opcode() const;
duke@0 241 virtual uint ideal_reg() const { return Op_RegP; }
duke@0 242 virtual Node *Ideal_DU_postCCP( PhaseCCP * );
duke@0 243 };
duke@0 244
duke@0 245 //------------------------------CheckCastPPNode--------------------------------
duke@0 246 // for _checkcast, cast pointer to pointer (different type), without JOIN,
duke@0 247 class CheckCastPPNode: public TypeNode {
duke@0 248 public:
duke@0 249 CheckCastPPNode( Node *c, Node *n, const Type *t ) : TypeNode(t,2) {
duke@0 250 init_class_id(Class_CheckCastPP);
duke@0 251 init_req(0, c);
duke@0 252 init_req(1, n);
duke@0 253 }
kvn@115 254
duke@0 255 virtual Node *Identity( PhaseTransform *phase );
duke@0 256 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 257 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 258 virtual int Opcode() const;
duke@0 259 virtual uint ideal_reg() const { return Op_RegP; }
duke@0 260 // No longer remove CheckCast after CCP as it gives me a place to hang
duke@0 261 // the proper address type - which is required to compute anti-deps.
duke@0 262 //virtual Node *Ideal_DU_postCCP( PhaseCCP * );
duke@0 263 };
duke@0 264
coleenp@108 265
coleenp@108 266 //------------------------------EncodeP--------------------------------
coleenp@108 267 // Encodes an oop pointers into its compressed form
coleenp@108 268 // Takes an extra argument which is the real heap base as a long which
coleenp@108 269 // may be useful for code generation in the backend.
coleenp@108 270 class EncodePNode : public TypeNode {
coleenp@108 271 public:
coleenp@108 272 EncodePNode(Node* value, const Type* type):
coleenp@108 273 TypeNode(type, 2) {
kvn@156 274 init_class_id(Class_EncodeP);
coleenp@108 275 init_req(0, NULL);
coleenp@108 276 init_req(1, value);
coleenp@108 277 }
coleenp@108 278 virtual int Opcode() const;
coleenp@108 279 virtual Node *Identity( PhaseTransform *phase );
kvn@113 280 virtual const Type *Value( PhaseTransform *phase ) const;
coleenp@108 281 virtual uint ideal_reg() const { return Op_RegN; }
coleenp@108 282
kvn@151 283 virtual Node *Ideal_DU_postCCP( PhaseCCP *ccp );
coleenp@108 284 };
coleenp@108 285
coleenp@108 286 //------------------------------DecodeN--------------------------------
coleenp@108 287 // Converts a narrow oop into a real oop ptr.
coleenp@108 288 // Takes an extra argument which is the real heap base as a long which
coleenp@108 289 // may be useful for code generation in the backend.
coleenp@108 290 class DecodeNNode : public TypeNode {
coleenp@108 291 public:
coleenp@108 292 DecodeNNode(Node* value, const Type* type):
coleenp@108 293 TypeNode(type, 2) {
kvn@156 294 init_class_id(Class_DecodeN);
coleenp@108 295 init_req(0, NULL);
coleenp@108 296 init_req(1, value);
coleenp@108 297 }
coleenp@108 298 virtual int Opcode() const;
coleenp@108 299 virtual Node *Identity( PhaseTransform *phase );
kvn@113 300 virtual const Type *Value( PhaseTransform *phase ) const;
coleenp@108 301 virtual uint ideal_reg() const { return Op_RegP; }
coleenp@108 302 };
coleenp@108 303
duke@0 304 //------------------------------Conv2BNode-------------------------------------
duke@0 305 // Convert int/pointer to a Boolean. Map zero to zero, all else to 1.
duke@0 306 class Conv2BNode : public Node {
duke@0 307 public:
duke@0 308 Conv2BNode( Node *i ) : Node(0,i) {}
duke@0 309 virtual int Opcode() const;
duke@0 310 virtual const Type *bottom_type() const { return TypeInt::BOOL; }
duke@0 311 virtual Node *Identity( PhaseTransform *phase );
duke@0 312 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 313 virtual uint ideal_reg() const { return Op_RegI; }
duke@0 314 };
duke@0 315
duke@0 316 // The conversions operations are all Alpha sorted. Please keep it that way!
duke@0 317 //------------------------------ConvD2FNode------------------------------------
duke@0 318 // Convert double to float
duke@0 319 class ConvD2FNode : public Node {
duke@0 320 public:
duke@0 321 ConvD2FNode( Node *in1 ) : Node(0,in1) {}
duke@0 322 virtual int Opcode() const;
duke@0 323 virtual const Type *bottom_type() const { return Type::FLOAT; }
duke@0 324 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 325 virtual Node *Identity( PhaseTransform *phase );
duke@0 326 virtual uint ideal_reg() const { return Op_RegF; }
duke@0 327 };
duke@0 328
duke@0 329 //------------------------------ConvD2INode------------------------------------
duke@0 330 // Convert Double to Integer
duke@0 331 class ConvD2INode : public Node {
duke@0 332 public:
duke@0 333 ConvD2INode( Node *in1 ) : Node(0,in1) {}
duke@0 334 virtual int Opcode() const;
duke@0 335 virtual const Type *bottom_type() const { return TypeInt::INT; }
duke@0 336 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 337 virtual Node *Identity( PhaseTransform *phase );
duke@0 338 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 339 virtual uint ideal_reg() const { return Op_RegI; }
duke@0 340 };
duke@0 341
duke@0 342 //------------------------------ConvD2LNode------------------------------------
duke@0 343 // Convert Double to Long
duke@0 344 class ConvD2LNode : public Node {
duke@0 345 public:
duke@0 346 ConvD2LNode( Node *dbl ) : Node(0,dbl) {}
duke@0 347 virtual int Opcode() const;
duke@0 348 virtual const Type *bottom_type() const { return TypeLong::LONG; }
duke@0 349 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 350 virtual Node *Identity( PhaseTransform *phase );
duke@0 351 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 352 virtual uint ideal_reg() const { return Op_RegL; }
duke@0 353 };
duke@0 354
duke@0 355 //------------------------------ConvF2DNode------------------------------------
duke@0 356 // Convert Float to a Double.
duke@0 357 class ConvF2DNode : public Node {
duke@0 358 public:
duke@0 359 ConvF2DNode( Node *in1 ) : Node(0,in1) {}
duke@0 360 virtual int Opcode() const;
duke@0 361 virtual const Type *bottom_type() const { return Type::DOUBLE; }
duke@0 362 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 363 virtual uint ideal_reg() const { return Op_RegD; }
duke@0 364 };
duke@0 365
duke@0 366 //------------------------------ConvF2INode------------------------------------
duke@0 367 // Convert float to integer
duke@0 368 class ConvF2INode : public Node {
duke@0 369 public:
duke@0 370 ConvF2INode( Node *in1 ) : Node(0,in1) {}
duke@0 371 virtual int Opcode() const;
duke@0 372 virtual const Type *bottom_type() const { return TypeInt::INT; }
duke@0 373 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 374 virtual Node *Identity( PhaseTransform *phase );
duke@0 375 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 376 virtual uint ideal_reg() const { return Op_RegI; }
duke@0 377 };
duke@0 378
duke@0 379 //------------------------------ConvF2LNode------------------------------------
duke@0 380 // Convert float to long
duke@0 381 class ConvF2LNode : public Node {
duke@0 382 public:
duke@0 383 ConvF2LNode( Node *in1 ) : Node(0,in1) {}
duke@0 384 virtual int Opcode() const;
duke@0 385 virtual const Type *bottom_type() const { return TypeLong::LONG; }
duke@0 386 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 387 virtual Node *Identity( PhaseTransform *phase );
duke@0 388 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 389 virtual uint ideal_reg() const { return Op_RegL; }
duke@0 390 };
duke@0 391
duke@0 392 //------------------------------ConvI2DNode------------------------------------
duke@0 393 // Convert Integer to Double
duke@0 394 class ConvI2DNode : public Node {
duke@0 395 public:
duke@0 396 ConvI2DNode( Node *in1 ) : Node(0,in1) {}
duke@0 397 virtual int Opcode() const;
duke@0 398 virtual const Type *bottom_type() const { return Type::DOUBLE; }
duke@0 399 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 400 virtual uint ideal_reg() const { return Op_RegD; }
duke@0 401 };
duke@0 402
duke@0 403 //------------------------------ConvI2FNode------------------------------------
duke@0 404 // Convert Integer to Float
duke@0 405 class ConvI2FNode : public Node {
duke@0 406 public:
duke@0 407 ConvI2FNode( Node *in1 ) : Node(0,in1) {}
duke@0 408 virtual int Opcode() const;
duke@0 409 virtual const Type *bottom_type() const { return Type::FLOAT; }
duke@0 410 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 411 virtual Node *Identity( PhaseTransform *phase );
duke@0 412 virtual uint ideal_reg() const { return Op_RegF; }
duke@0 413 };
duke@0 414
duke@0 415 //------------------------------ConvI2LNode------------------------------------
duke@0 416 // Convert integer to long
duke@0 417 class ConvI2LNode : public TypeNode {
duke@0 418 public:
duke@0 419 ConvI2LNode(Node *in1, const TypeLong* t = TypeLong::INT)
duke@0 420 : TypeNode(t, 2)
duke@0 421 { init_req(1, in1); }
duke@0 422 virtual int Opcode() const;
duke@0 423 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 424 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 425 virtual uint ideal_reg() const { return Op_RegL; }
duke@0 426 };
duke@0 427
duke@0 428 //------------------------------ConvL2DNode------------------------------------
duke@0 429 // Convert Long to Double
duke@0 430 class ConvL2DNode : public Node {
duke@0 431 public:
duke@0 432 ConvL2DNode( Node *in1 ) : Node(0,in1) {}
duke@0 433 virtual int Opcode() const;
duke@0 434 virtual const Type *bottom_type() const { return Type::DOUBLE; }
duke@0 435 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 436 virtual uint ideal_reg() const { return Op_RegD; }
duke@0 437 };
duke@0 438
duke@0 439 //------------------------------ConvL2FNode------------------------------------
duke@0 440 // Convert Long to Float
duke@0 441 class ConvL2FNode : public Node {
duke@0 442 public:
duke@0 443 ConvL2FNode( Node *in1 ) : Node(0,in1) {}
duke@0 444 virtual int Opcode() const;
duke@0 445 virtual const Type *bottom_type() const { return Type::FLOAT; }
duke@0 446 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 447 virtual uint ideal_reg() const { return Op_RegF; }
duke@0 448 };
duke@0 449
duke@0 450 //------------------------------ConvL2INode------------------------------------
duke@0 451 // Convert long to integer
duke@0 452 class ConvL2INode : public Node {
duke@0 453 public:
duke@0 454 ConvL2INode( Node *in1 ) : Node(0,in1) {}
duke@0 455 virtual int Opcode() const;
duke@0 456 virtual const Type *bottom_type() const { return TypeInt::INT; }
duke@0 457 virtual Node *Identity( PhaseTransform *phase );
duke@0 458 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 459 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 460 virtual uint ideal_reg() const { return Op_RegI; }
duke@0 461 };
duke@0 462
duke@0 463 //------------------------------CastX2PNode-------------------------------------
duke@0 464 // convert a machine-pointer-sized integer to a raw pointer
duke@0 465 class CastX2PNode : public Node {
duke@0 466 public:
duke@0 467 CastX2PNode( Node *n ) : Node(NULL, n) {}
duke@0 468 virtual int Opcode() const;
duke@0 469 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 470 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 471 virtual Node *Identity( PhaseTransform *phase );
duke@0 472 virtual uint ideal_reg() const { return Op_RegP; }
duke@0 473 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
duke@0 474 };
duke@0 475
duke@0 476 //------------------------------CastP2XNode-------------------------------------
duke@0 477 // Used in both 32-bit and 64-bit land.
duke@0 478 // Used for card-marks and unsafe pointer math.
duke@0 479 class CastP2XNode : public Node {
duke@0 480 public:
duke@0 481 CastP2XNode( Node *ctrl, Node *n ) : Node(ctrl, n) {}
duke@0 482 virtual int Opcode() const;
duke@0 483 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 484 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 485 virtual Node *Identity( PhaseTransform *phase );
duke@0 486 virtual uint ideal_reg() const { return Op_RegX; }
duke@0 487 virtual const Type *bottom_type() const { return TypeX_X; }
duke@0 488 // Return false to keep node from moving away from an associated card mark.
duke@0 489 virtual bool depends_only_on_test() const { return false; }
duke@0 490 };
duke@0 491
duke@0 492 //------------------------------MemMoveNode------------------------------------
duke@0 493 // Memory to memory move. Inserted very late, after allocation.
duke@0 494 class MemMoveNode : public Node {
duke@0 495 public:
duke@0 496 MemMoveNode( Node *dst, Node *src ) : Node(0,dst,src) {}
duke@0 497 virtual int Opcode() const;
duke@0 498 };
duke@0 499
duke@0 500 //------------------------------ThreadLocalNode--------------------------------
duke@0 501 // Ideal Node which returns the base of ThreadLocalStorage.
duke@0 502 class ThreadLocalNode : public Node {
duke@0 503 public:
duke@0 504 ThreadLocalNode( ) : Node((Node*)Compile::current()->root()) {}
duke@0 505 virtual int Opcode() const;
duke@0 506 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM;}
duke@0 507 virtual uint ideal_reg() const { return Op_RegP; }
duke@0 508 };
duke@0 509
duke@0 510 //------------------------------LoadReturnPCNode-------------------------------
duke@0 511 class LoadReturnPCNode: public Node {
duke@0 512 public:
duke@0 513 LoadReturnPCNode(Node *c) : Node(c) { }
duke@0 514 virtual int Opcode() const;
duke@0 515 virtual uint ideal_reg() const { return Op_RegP; }
duke@0 516 };
duke@0 517
duke@0 518
duke@0 519 //-----------------------------RoundFloatNode----------------------------------
duke@0 520 class RoundFloatNode: public Node {
duke@0 521 public:
duke@0 522 RoundFloatNode(Node* c, Node *in1): Node(c, in1) {}
duke@0 523 virtual int Opcode() const;
duke@0 524 virtual const Type *bottom_type() const { return Type::FLOAT; }
duke@0 525 virtual uint ideal_reg() const { return Op_RegF; }
duke@0 526 virtual Node *Identity( PhaseTransform *phase );
duke@0 527 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 528 };
duke@0 529
duke@0 530
duke@0 531 //-----------------------------RoundDoubleNode---------------------------------
duke@0 532 class RoundDoubleNode: public Node {
duke@0 533 public:
duke@0 534 RoundDoubleNode(Node* c, Node *in1): Node(c, in1) {}
duke@0 535 virtual int Opcode() const;
duke@0 536 virtual const Type *bottom_type() const { return Type::DOUBLE; }
duke@0 537 virtual uint ideal_reg() const { return Op_RegD; }
duke@0 538 virtual Node *Identity( PhaseTransform *phase );
duke@0 539 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 540 };
duke@0 541
duke@0 542 //------------------------------Opaque1Node------------------------------------
duke@0 543 // A node to prevent unwanted optimizations. Allows constant folding.
duke@0 544 // Stops value-numbering, Ideal calls or Identity functions.
duke@0 545 class Opaque1Node : public Node {
duke@0 546 virtual uint hash() const ; // { return NO_HASH; }
duke@0 547 virtual uint cmp( const Node &n ) const;
duke@0 548 public:
kvn@197 549 Opaque1Node( Compile* C, Node *n ) : Node(0,n) {
kvn@197 550 // Put it on the Macro nodes list to removed during macro nodes expansion.
kvn@197 551 init_flags(Flag_is_macro);
kvn@197 552 C->add_macro_node(this);
kvn@197 553 }
duke@0 554 // Special version for the pre-loop to hold the original loop limit
duke@0 555 // which is consumed by range check elimination.
kvn@197 556 Opaque1Node( Compile* C, Node *n, Node* orig_limit ) : Node(0,n,orig_limit) {
kvn@197 557 // Put it on the Macro nodes list to removed during macro nodes expansion.
kvn@197 558 init_flags(Flag_is_macro);
kvn@197 559 C->add_macro_node(this);
kvn@197 560 }
duke@0 561 Node* original_loop_limit() { return req()==3 ? in(2) : NULL; }
duke@0 562 virtual int Opcode() const;
duke@0 563 virtual const Type *bottom_type() const { return TypeInt::INT; }
duke@0 564 virtual Node *Identity( PhaseTransform *phase );
duke@0 565 };
duke@0 566
duke@0 567 //------------------------------Opaque2Node------------------------------------
duke@0 568 // A node to prevent unwanted optimizations. Allows constant folding. Stops
duke@0 569 // value-numbering, most Ideal calls or Identity functions. This Node is
duke@0 570 // specifically designed to prevent the pre-increment value of a loop trip
duke@0 571 // counter from being live out of the bottom of the loop (hence causing the
duke@0 572 // pre- and post-increment values both being live and thus requiring an extra
duke@0 573 // temp register and an extra move). If we "accidentally" optimize through
duke@0 574 // this kind of a Node, we'll get slightly pessimal, but correct, code. Thus
duke@0 575 // it's OK to be slightly sloppy on optimizations here.
duke@0 576 class Opaque2Node : public Node {
duke@0 577 virtual uint hash() const ; // { return NO_HASH; }
duke@0 578 virtual uint cmp( const Node &n ) const;
duke@0 579 public:
kvn@197 580 Opaque2Node( Compile* C, Node *n ) : Node(0,n) {
kvn@197 581 // Put it on the Macro nodes list to removed during macro nodes expansion.
kvn@197 582 init_flags(Flag_is_macro);
kvn@197 583 C->add_macro_node(this);
kvn@197 584 }
duke@0 585 virtual int Opcode() const;
duke@0 586 virtual const Type *bottom_type() const { return TypeInt::INT; }
duke@0 587 };
duke@0 588
duke@0 589 //----------------------PartialSubtypeCheckNode--------------------------------
duke@0 590 // The 2nd slow-half of a subtype check. Scan the subklass's 2ndary superklass
duke@0 591 // array for an instance of the superklass. Set a hidden internal cache on a
duke@0 592 // hit (cache is checked with exposed code in gen_subtype_check()). Return
duke@0 593 // not zero for a miss or zero for a hit.
duke@0 594 class PartialSubtypeCheckNode : public Node {
duke@0 595 public:
duke@0 596 PartialSubtypeCheckNode(Node* c, Node* sub, Node* super) : Node(c,sub,super) {}
duke@0 597 virtual int Opcode() const;
duke@0 598 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
duke@0 599 virtual uint ideal_reg() const { return Op_RegP; }
duke@0 600 };
duke@0 601
duke@0 602 //
duke@0 603 class MoveI2FNode : public Node {
duke@0 604 public:
duke@0 605 MoveI2FNode( Node *value ) : Node(0,value) {}
duke@0 606 virtual int Opcode() const;
duke@0 607 virtual const Type *bottom_type() const { return Type::FLOAT; }
duke@0 608 virtual uint ideal_reg() const { return Op_RegF; }
duke@0 609 virtual const Type* Value( PhaseTransform *phase ) const;
duke@0 610 };
duke@0 611
duke@0 612 class MoveL2DNode : public Node {
duke@0 613 public:
duke@0 614 MoveL2DNode( Node *value ) : Node(0,value) {}
duke@0 615 virtual int Opcode() const;
duke@0 616 virtual const Type *bottom_type() const { return Type::DOUBLE; }
duke@0 617 virtual uint ideal_reg() const { return Op_RegD; }
duke@0 618 virtual const Type* Value( PhaseTransform *phase ) const;
duke@0 619 };
duke@0 620
duke@0 621 class MoveF2INode : public Node {
duke@0 622 public:
duke@0 623 MoveF2INode( Node *value ) : Node(0,value) {}
duke@0 624 virtual int Opcode() const;
duke@0 625 virtual const Type *bottom_type() const { return TypeInt::INT; }
duke@0 626 virtual uint ideal_reg() const { return Op_RegI; }
duke@0 627 virtual const Type* Value( PhaseTransform *phase ) const;
duke@0 628 };
duke@0 629
duke@0 630 class MoveD2LNode : public Node {
duke@0 631 public:
duke@0 632 MoveD2LNode( Node *value ) : Node(0,value) {}
duke@0 633 virtual int Opcode() const;
duke@0 634 virtual const Type *bottom_type() const { return TypeLong::LONG; }
duke@0 635 virtual uint ideal_reg() const { return Op_RegL; }
duke@0 636 virtual const Type* Value( PhaseTransform *phase ) const;
duke@0 637 };
twisti@620 638
twisti@747 639 //---------- CountBitsNode -----------------------------------------------------
twisti@747 640 class CountBitsNode : public Node {
twisti@620 641 public:
twisti@747 642 CountBitsNode(Node* in1) : Node(0, in1) {}
twisti@620 643 const Type* bottom_type() const { return TypeInt::INT; }
twisti@620 644 virtual uint ideal_reg() const { return Op_RegI; }
twisti@620 645 };
twisti@620 646
twisti@747 647 //---------- CountLeadingZerosINode --------------------------------------------
twisti@747 648 // Count leading zeros (0-bit count starting from MSB) of an integer.
twisti@747 649 class CountLeadingZerosINode : public CountBitsNode {
twisti@747 650 public:
twisti@747 651 CountLeadingZerosINode(Node* in1) : CountBitsNode(in1) {}
twisti@747 652 virtual int Opcode() const;
twisti@747 653 virtual const Type* Value(PhaseTransform* phase) const;
twisti@747 654 };
twisti@747 655
twisti@747 656 //---------- CountLeadingZerosLNode --------------------------------------------
twisti@747 657 // Count leading zeros (0-bit count starting from MSB) of a long.
twisti@747 658 class CountLeadingZerosLNode : public CountBitsNode {
twisti@747 659 public:
twisti@747 660 CountLeadingZerosLNode(Node* in1) : CountBitsNode(in1) {}
twisti@747 661 virtual int Opcode() const;
twisti@747 662 virtual const Type* Value(PhaseTransform* phase) const;
twisti@747 663 };
twisti@747 664
twisti@747 665 //---------- CountTrailingZerosINode -------------------------------------------
twisti@747 666 // Count trailing zeros (0-bit count starting from LSB) of an integer.
twisti@747 667 class CountTrailingZerosINode : public CountBitsNode {
twisti@747 668 public:
twisti@747 669 CountTrailingZerosINode(Node* in1) : CountBitsNode(in1) {}
twisti@747 670 virtual int Opcode() const;
twisti@747 671 virtual const Type* Value(PhaseTransform* phase) const;
twisti@747 672 };
twisti@747 673
twisti@747 674 //---------- CountTrailingZerosLNode -------------------------------------------
twisti@747 675 // Count trailing zeros (0-bit count starting from LSB) of a long.
twisti@747 676 class CountTrailingZerosLNode : public CountBitsNode {
twisti@747 677 public:
twisti@747 678 CountTrailingZerosLNode(Node* in1) : CountBitsNode(in1) {}
twisti@747 679 virtual int Opcode() const;
twisti@747 680 virtual const Type* Value(PhaseTransform* phase) const;
twisti@747 681 };
twisti@747 682
twisti@747 683 //---------- PopCountINode -----------------------------------------------------
twisti@747 684 // Population count (bit count) of an integer.
twisti@747 685 class PopCountINode : public CountBitsNode {
twisti@747 686 public:
twisti@747 687 PopCountINode(Node* in1) : CountBitsNode(in1) {}
twisti@747 688 virtual int Opcode() const;
twisti@747 689 };
twisti@747 690
twisti@620 691 //---------- PopCountLNode -----------------------------------------------------
twisti@620 692 // Population count (bit count) of a long.
twisti@747 693 class PopCountLNode : public CountBitsNode {
twisti@620 694 public:
twisti@747 695 PopCountLNode(Node* in1) : CountBitsNode(in1) {}
twisti@620 696 virtual int Opcode() const;
twisti@620 697 };