src/share/vm/opto/connode.hpp

Tue, 17 Oct 2017 12:58:25 +0800

author
aoqi
date
Tue, 17 Oct 2017 12:58:25 +0800
changeset 7994
04ff2f6cd0eb
parent 7789
eb8b5cc64669
parent 7535
7ae4e26cb1e0
child 8604
04d83ba48607
permissions
-rw-r--r--

merge

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

mercurial