src/share/vm/opto/connode.hpp

Thu, 24 May 2018 19:26:50 +0800

author
aoqi
date
Thu, 24 May 2018 19:26:50 +0800
changeset 8862
fd13a567f179
parent 8604
04d83ba48607
permissions
-rw-r--r--

#7046 C2 supports long branch
Contributed-by: fujie

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;
thartmann@8285 247 // Is this node dependent on a range check?
thartmann@8285 248 const bool _range_check_dependency;
roland@7394 249
roland@7394 250 protected:
roland@7394 251 virtual uint cmp( const Node &n ) const;
roland@7394 252 virtual uint size_of() const;
roland@7394 253
aoqi@0 254 public:
thartmann@8285 255 CastIINode(Node *n, const Type *t, bool carry_dependency = false, bool range_check_dependency = false)
thartmann@8285 256 : ConstraintCastNode(n,t), _carry_dependency(carry_dependency), _range_check_dependency(range_check_dependency) {
thartmann@8285 257 init_class_id(Class_CastII);
thartmann@8285 258 }
aoqi@0 259 virtual int Opcode() const;
aoqi@0 260 virtual uint ideal_reg() const { return Op_RegI; }
roland@7394 261 virtual Node *Identity( PhaseTransform *phase );
roland@7394 262 virtual const Type *Value( PhaseTransform *phase ) const;
roland@7394 263 virtual Node *Ideal_DU_postCCP( PhaseCCP * );
thartmann@8285 264 const bool has_range_check() {
thartmann@8285 265 #ifdef _LP64
thartmann@8285 266 return _range_check_dependency;
thartmann@8285 267 #else
thartmann@8285 268 assert(!_range_check_dependency, "Should not have range check dependency");
thartmann@8285 269 return false;
thartmann@8285 270 #endif
thartmann@8285 271 }
roland@7394 272 #ifndef PRODUCT
roland@7394 273 virtual void dump_spec(outputStream *st) const;
roland@7394 274 #endif
aoqi@0 275 };
aoqi@0 276
aoqi@0 277 //------------------------------CastPPNode-------------------------------------
aoqi@0 278 // cast pointer to pointer (different type)
aoqi@0 279 class CastPPNode: public ConstraintCastNode {
aoqi@0 280 public:
aoqi@0 281 CastPPNode (Node *n, const Type *t ): ConstraintCastNode(n, t) {}
aoqi@0 282 virtual int Opcode() const;
aoqi@0 283 virtual uint ideal_reg() const { return Op_RegP; }
aoqi@0 284 virtual Node *Ideal_DU_postCCP( PhaseCCP * );
aoqi@0 285 };
aoqi@0 286
aoqi@0 287 //------------------------------CheckCastPPNode--------------------------------
aoqi@0 288 // for _checkcast, cast pointer to pointer (different type), without JOIN,
aoqi@0 289 class CheckCastPPNode: public TypeNode {
aoqi@0 290 public:
aoqi@0 291 CheckCastPPNode( Node *c, Node *n, const Type *t ) : TypeNode(t,2) {
aoqi@0 292 init_class_id(Class_CheckCastPP);
aoqi@0 293 init_req(0, c);
aoqi@0 294 init_req(1, n);
aoqi@0 295 }
aoqi@0 296
aoqi@0 297 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 298 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 299 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
aoqi@0 300 virtual int Opcode() const;
aoqi@0 301 virtual uint ideal_reg() const { return Op_RegP; }
aoqi@0 302 // No longer remove CheckCast after CCP as it gives me a place to hang
aoqi@0 303 // the proper address type - which is required to compute anti-deps.
aoqi@0 304 //virtual Node *Ideal_DU_postCCP( PhaseCCP * );
aoqi@0 305 };
aoqi@0 306
aoqi@0 307
aoqi@0 308 //------------------------------EncodeNarrowPtr--------------------------------
aoqi@0 309 class EncodeNarrowPtrNode : public TypeNode {
aoqi@0 310 protected:
aoqi@0 311 EncodeNarrowPtrNode(Node* value, const Type* type):
aoqi@0 312 TypeNode(type, 2) {
aoqi@0 313 init_class_id(Class_EncodeNarrowPtr);
aoqi@0 314 init_req(0, NULL);
aoqi@0 315 init_req(1, value);
aoqi@0 316 }
aoqi@0 317 public:
aoqi@0 318 virtual uint ideal_reg() const { return Op_RegN; }
aoqi@0 319 virtual Node *Ideal_DU_postCCP( PhaseCCP *ccp );
aoqi@0 320 };
aoqi@0 321
aoqi@0 322 //------------------------------EncodeP--------------------------------
aoqi@0 323 // Encodes an oop pointers into its compressed form
aoqi@0 324 // Takes an extra argument which is the real heap base as a long which
aoqi@0 325 // may be useful for code generation in the backend.
aoqi@0 326 class EncodePNode : public EncodeNarrowPtrNode {
aoqi@0 327 public:
aoqi@0 328 EncodePNode(Node* value, const Type* type):
aoqi@0 329 EncodeNarrowPtrNode(value, type) {
aoqi@0 330 init_class_id(Class_EncodeP);
aoqi@0 331 }
aoqi@0 332 virtual int Opcode() const;
aoqi@0 333 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 334 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 335 };
aoqi@0 336
aoqi@0 337 //------------------------------EncodePKlass--------------------------------
aoqi@0 338 // Encodes a klass pointer into its compressed form
aoqi@0 339 // Takes an extra argument which is the real heap base as a long which
aoqi@0 340 // may be useful for code generation in the backend.
aoqi@0 341 class EncodePKlassNode : public EncodeNarrowPtrNode {
aoqi@0 342 public:
aoqi@0 343 EncodePKlassNode(Node* value, const Type* type):
aoqi@0 344 EncodeNarrowPtrNode(value, type) {
aoqi@0 345 init_class_id(Class_EncodePKlass);
aoqi@0 346 }
aoqi@0 347 virtual int Opcode() const;
aoqi@0 348 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 349 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 350 };
aoqi@0 351
aoqi@0 352 //------------------------------DecodeNarrowPtr--------------------------------
aoqi@0 353 class DecodeNarrowPtrNode : public TypeNode {
aoqi@0 354 protected:
aoqi@0 355 DecodeNarrowPtrNode(Node* value, const Type* type):
aoqi@0 356 TypeNode(type, 2) {
aoqi@0 357 init_class_id(Class_DecodeNarrowPtr);
aoqi@0 358 init_req(0, NULL);
aoqi@0 359 init_req(1, value);
aoqi@0 360 }
aoqi@0 361 public:
aoqi@0 362 virtual uint ideal_reg() const { return Op_RegP; }
aoqi@0 363 };
aoqi@0 364
aoqi@0 365 //------------------------------DecodeN--------------------------------
aoqi@0 366 // Converts a narrow oop into a real oop ptr.
aoqi@0 367 // Takes an extra argument which is the real heap base as a long which
aoqi@0 368 // may be useful for code generation in the backend.
aoqi@0 369 class DecodeNNode : public DecodeNarrowPtrNode {
aoqi@0 370 public:
aoqi@0 371 DecodeNNode(Node* value, const Type* type):
aoqi@0 372 DecodeNarrowPtrNode(value, type) {
aoqi@0 373 init_class_id(Class_DecodeN);
aoqi@0 374 }
aoqi@0 375 virtual int Opcode() const;
aoqi@0 376 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 377 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 378 };
aoqi@0 379
aoqi@0 380 //------------------------------DecodeNKlass--------------------------------
aoqi@0 381 // Converts a narrow klass pointer into a real klass ptr.
aoqi@0 382 // Takes an extra argument which is the real heap base as a long which
aoqi@0 383 // may be useful for code generation in the backend.
aoqi@0 384 class DecodeNKlassNode : public DecodeNarrowPtrNode {
aoqi@0 385 public:
aoqi@0 386 DecodeNKlassNode(Node* value, const Type* type):
aoqi@0 387 DecodeNarrowPtrNode(value, type) {
aoqi@0 388 init_class_id(Class_DecodeNKlass);
aoqi@0 389 }
aoqi@0 390 virtual int Opcode() const;
aoqi@0 391 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 392 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 393 };
aoqi@0 394
aoqi@0 395 //------------------------------Conv2BNode-------------------------------------
aoqi@0 396 // Convert int/pointer to a Boolean. Map zero to zero, all else to 1.
aoqi@0 397 class Conv2BNode : public Node {
aoqi@0 398 public:
aoqi@0 399 Conv2BNode( Node *i ) : Node(0,i) {}
aoqi@0 400 virtual int Opcode() const;
aoqi@0 401 virtual const Type *bottom_type() const { return TypeInt::BOOL; }
aoqi@0 402 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 403 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 404 virtual uint ideal_reg() const { return Op_RegI; }
aoqi@0 405 };
aoqi@0 406
aoqi@0 407 // The conversions operations are all Alpha sorted. Please keep it that way!
aoqi@0 408 //------------------------------ConvD2FNode------------------------------------
aoqi@0 409 // Convert double to float
aoqi@0 410 class ConvD2FNode : public Node {
aoqi@0 411 public:
aoqi@0 412 ConvD2FNode( Node *in1 ) : Node(0,in1) {}
aoqi@0 413 virtual int Opcode() const;
aoqi@0 414 virtual const Type *bottom_type() const { return Type::FLOAT; }
aoqi@0 415 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 416 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 417 virtual uint ideal_reg() const { return Op_RegF; }
aoqi@0 418 };
aoqi@0 419
aoqi@0 420 //------------------------------ConvD2INode------------------------------------
aoqi@0 421 // Convert Double to Integer
aoqi@0 422 class ConvD2INode : public Node {
aoqi@0 423 public:
aoqi@0 424 ConvD2INode( Node *in1 ) : Node(0,in1) {}
aoqi@0 425 virtual int Opcode() const;
aoqi@0 426 virtual const Type *bottom_type() const { return TypeInt::INT; }
aoqi@0 427 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 428 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 429 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
aoqi@0 430 virtual uint ideal_reg() const { return Op_RegI; }
aoqi@0 431 };
aoqi@0 432
aoqi@0 433 //------------------------------ConvD2LNode------------------------------------
aoqi@0 434 // Convert Double to Long
aoqi@0 435 class ConvD2LNode : public Node {
aoqi@0 436 public:
aoqi@0 437 ConvD2LNode( Node *dbl ) : Node(0,dbl) {}
aoqi@0 438 virtual int Opcode() const;
aoqi@0 439 virtual const Type *bottom_type() const { return TypeLong::LONG; }
aoqi@0 440 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 441 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 442 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
aoqi@0 443 virtual uint ideal_reg() const { return Op_RegL; }
aoqi@0 444 };
aoqi@0 445
aoqi@0 446 //------------------------------ConvF2DNode------------------------------------
aoqi@0 447 // Convert Float to a Double.
aoqi@0 448 class ConvF2DNode : public Node {
aoqi@0 449 public:
aoqi@0 450 ConvF2DNode( Node *in1 ) : Node(0,in1) {}
aoqi@0 451 virtual int Opcode() const;
aoqi@0 452 virtual const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 453 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 454 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 455 };
aoqi@0 456
aoqi@0 457 //------------------------------ConvF2INode------------------------------------
aoqi@0 458 // Convert float to integer
aoqi@0 459 class ConvF2INode : public Node {
aoqi@0 460 public:
aoqi@0 461 ConvF2INode( Node *in1 ) : Node(0,in1) {}
aoqi@0 462 virtual int Opcode() const;
aoqi@0 463 virtual const Type *bottom_type() const { return TypeInt::INT; }
aoqi@0 464 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 465 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 466 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
aoqi@0 467 virtual uint ideal_reg() const { return Op_RegI; }
aoqi@0 468 };
aoqi@0 469
aoqi@0 470 //------------------------------ConvF2LNode------------------------------------
aoqi@0 471 // Convert float to long
aoqi@0 472 class ConvF2LNode : public Node {
aoqi@0 473 public:
aoqi@0 474 ConvF2LNode( Node *in1 ) : Node(0,in1) {}
aoqi@0 475 virtual int Opcode() const;
aoqi@0 476 virtual const Type *bottom_type() const { return TypeLong::LONG; }
aoqi@0 477 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 478 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 479 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
aoqi@0 480 virtual uint ideal_reg() const { return Op_RegL; }
aoqi@0 481 };
aoqi@0 482
aoqi@0 483 //------------------------------ConvI2DNode------------------------------------
aoqi@0 484 // Convert Integer to Double
aoqi@0 485 class ConvI2DNode : public Node {
aoqi@0 486 public:
aoqi@0 487 ConvI2DNode( Node *in1 ) : Node(0,in1) {}
aoqi@0 488 virtual int Opcode() const;
aoqi@0 489 virtual const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 490 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 491 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 492 };
aoqi@0 493
aoqi@0 494 //------------------------------ConvI2FNode------------------------------------
aoqi@0 495 // Convert Integer to Float
aoqi@0 496 class ConvI2FNode : public Node {
aoqi@0 497 public:
aoqi@0 498 ConvI2FNode( Node *in1 ) : Node(0,in1) {}
aoqi@0 499 virtual int Opcode() const;
aoqi@0 500 virtual const Type *bottom_type() const { return Type::FLOAT; }
aoqi@0 501 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 502 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 503 virtual uint ideal_reg() const { return Op_RegF; }
aoqi@0 504 };
aoqi@0 505
aoqi@0 506 //------------------------------ConvI2LNode------------------------------------
aoqi@0 507 // Convert integer to long
aoqi@0 508 class ConvI2LNode : public TypeNode {
aoqi@0 509 public:
aoqi@0 510 ConvI2LNode(Node *in1, const TypeLong* t = TypeLong::INT)
aoqi@0 511 : TypeNode(t, 2)
aoqi@0 512 { init_req(1, in1); }
aoqi@0 513 virtual int Opcode() const;
aoqi@0 514 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 515 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
aoqi@0 516 virtual uint ideal_reg() const { return Op_RegL; }
aoqi@0 517 };
aoqi@0 518
aoqi@0 519 //------------------------------ConvL2DNode------------------------------------
aoqi@0 520 // Convert Long to Double
aoqi@0 521 class ConvL2DNode : public Node {
aoqi@0 522 public:
aoqi@0 523 ConvL2DNode( Node *in1 ) : Node(0,in1) {}
aoqi@0 524 virtual int Opcode() const;
aoqi@0 525 virtual const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 526 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 527 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 528 };
aoqi@0 529
aoqi@0 530 //------------------------------ConvL2FNode------------------------------------
aoqi@0 531 // Convert Long to Float
aoqi@0 532 class ConvL2FNode : public Node {
aoqi@0 533 public:
aoqi@0 534 ConvL2FNode( Node *in1 ) : Node(0,in1) {}
aoqi@0 535 virtual int Opcode() const;
aoqi@0 536 virtual const Type *bottom_type() const { return Type::FLOAT; }
aoqi@0 537 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 538 virtual uint ideal_reg() const { return Op_RegF; }
aoqi@0 539 };
aoqi@0 540
aoqi@0 541 //------------------------------ConvL2INode------------------------------------
aoqi@0 542 // Convert long to integer
aoqi@0 543 class ConvL2INode : public Node {
aoqi@0 544 public:
aoqi@0 545 ConvL2INode( Node *in1 ) : Node(0,in1) {}
aoqi@0 546 virtual int Opcode() const;
aoqi@0 547 virtual const Type *bottom_type() const { return TypeInt::INT; }
aoqi@0 548 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 549 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 550 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
aoqi@0 551 virtual uint ideal_reg() const { return Op_RegI; }
aoqi@0 552 };
aoqi@0 553
aoqi@0 554 //------------------------------CastX2PNode-------------------------------------
aoqi@0 555 // convert a machine-pointer-sized integer to a raw pointer
aoqi@0 556 class CastX2PNode : public Node {
aoqi@0 557 public:
aoqi@0 558 CastX2PNode( Node *n ) : Node(NULL, n) {}
aoqi@0 559 virtual int Opcode() const;
aoqi@0 560 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 561 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
aoqi@0 562 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 563 virtual uint ideal_reg() const { return Op_RegP; }
aoqi@0 564 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
aoqi@0 565 };
aoqi@0 566
aoqi@0 567 //------------------------------CastP2XNode-------------------------------------
aoqi@0 568 // Used in both 32-bit and 64-bit land.
aoqi@0 569 // Used for card-marks and unsafe pointer math.
aoqi@0 570 class CastP2XNode : public Node {
aoqi@0 571 public:
aoqi@0 572 CastP2XNode( Node *ctrl, Node *n ) : Node(ctrl, n) {}
aoqi@0 573 virtual int Opcode() const;
aoqi@0 574 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 575 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
aoqi@0 576 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 577 virtual uint ideal_reg() const { return Op_RegX; }
aoqi@0 578 virtual const Type *bottom_type() const { return TypeX_X; }
aoqi@0 579 // Return false to keep node from moving away from an associated card mark.
aoqi@0 580 virtual bool depends_only_on_test() const { return false; }
aoqi@0 581 };
aoqi@0 582
aoqi@0 583 //------------------------------ThreadLocalNode--------------------------------
aoqi@0 584 // Ideal Node which returns the base of ThreadLocalStorage.
aoqi@0 585 class ThreadLocalNode : public Node {
aoqi@0 586 public:
aoqi@0 587 ThreadLocalNode( ) : Node((Node*)Compile::current()->root()) {}
aoqi@0 588 virtual int Opcode() const;
aoqi@0 589 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM;}
aoqi@0 590 virtual uint ideal_reg() const { return Op_RegP; }
aoqi@0 591 };
aoqi@0 592
aoqi@0 593 //------------------------------LoadReturnPCNode-------------------------------
aoqi@0 594 class LoadReturnPCNode: public Node {
aoqi@0 595 public:
aoqi@0 596 LoadReturnPCNode(Node *c) : Node(c) { }
aoqi@0 597 virtual int Opcode() const;
aoqi@0 598 virtual uint ideal_reg() const { return Op_RegP; }
aoqi@0 599 };
aoqi@0 600
aoqi@0 601
aoqi@0 602 //-----------------------------RoundFloatNode----------------------------------
aoqi@0 603 class RoundFloatNode: public Node {
aoqi@0 604 public:
aoqi@0 605 RoundFloatNode(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::FLOAT; }
aoqi@0 608 virtual uint ideal_reg() const { return Op_RegF; }
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
aoqi@0 614 //-----------------------------RoundDoubleNode---------------------------------
aoqi@0 615 class RoundDoubleNode: public Node {
aoqi@0 616 public:
aoqi@0 617 RoundDoubleNode(Node* c, Node *in1): Node(c, in1) {}
aoqi@0 618 virtual int Opcode() const;
aoqi@0 619 virtual const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 620 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 621 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 622 virtual const Type *Value( PhaseTransform *phase ) const;
aoqi@0 623 };
aoqi@0 624
aoqi@0 625 //------------------------------Opaque1Node------------------------------------
aoqi@0 626 // A node to prevent unwanted optimizations. Allows constant folding.
aoqi@0 627 // Stops value-numbering, Ideal calls or Identity functions.
aoqi@0 628 class Opaque1Node : public Node {
aoqi@0 629 virtual uint hash() const ; // { return NO_HASH; }
aoqi@0 630 virtual uint cmp( const Node &n ) const;
aoqi@0 631 public:
aoqi@0 632 Opaque1Node( Compile* C, Node *n ) : Node(0,n) {
aoqi@0 633 // Put it on the Macro nodes list to removed during macro nodes expansion.
aoqi@0 634 init_flags(Flag_is_macro);
aoqi@0 635 C->add_macro_node(this);
aoqi@0 636 }
aoqi@0 637 // Special version for the pre-loop to hold the original loop limit
aoqi@0 638 // which is consumed by range check elimination.
aoqi@0 639 Opaque1Node( Compile* C, Node *n, Node* orig_limit ) : Node(0,n,orig_limit) {
aoqi@0 640 // Put it on the Macro nodes list to removed during macro nodes expansion.
aoqi@0 641 init_flags(Flag_is_macro);
aoqi@0 642 C->add_macro_node(this);
aoqi@0 643 }
aoqi@0 644 Node* original_loop_limit() { return req()==3 ? in(2) : NULL; }
aoqi@0 645 virtual int Opcode() const;
aoqi@0 646 virtual const Type *bottom_type() const { return TypeInt::INT; }
aoqi@0 647 virtual Node *Identity( PhaseTransform *phase );
aoqi@0 648 };
aoqi@0 649
aoqi@0 650 //------------------------------Opaque2Node------------------------------------
aoqi@0 651 // A node to prevent unwanted optimizations. Allows constant folding. Stops
aoqi@0 652 // value-numbering, most Ideal calls or Identity functions. This Node is
aoqi@0 653 // specifically designed to prevent the pre-increment value of a loop trip
aoqi@0 654 // counter from being live out of the bottom of the loop (hence causing the
aoqi@0 655 // pre- and post-increment values both being live and thus requiring an extra
aoqi@0 656 // temp register and an extra move). If we "accidentally" optimize through
aoqi@0 657 // this kind of a Node, we'll get slightly pessimal, but correct, code. Thus
aoqi@0 658 // it's OK to be slightly sloppy on optimizations here.
aoqi@0 659 class Opaque2Node : public Node {
aoqi@0 660 virtual uint hash() const ; // { return NO_HASH; }
aoqi@0 661 virtual uint cmp( const Node &n ) const;
aoqi@0 662 public:
aoqi@0 663 Opaque2Node( Compile* C, Node *n ) : Node(0,n) {
aoqi@0 664 // Put it on the Macro nodes list to removed during macro nodes expansion.
aoqi@0 665 init_flags(Flag_is_macro);
aoqi@0 666 C->add_macro_node(this);
aoqi@0 667 }
aoqi@0 668 virtual int Opcode() const;
aoqi@0 669 virtual const Type *bottom_type() const { return TypeInt::INT; }
aoqi@0 670 };
aoqi@0 671
aoqi@0 672 //------------------------------Opaque3Node------------------------------------
aoqi@0 673 // A node to prevent unwanted optimizations. Will be optimized only during
aoqi@0 674 // macro nodes expansion.
aoqi@0 675 class Opaque3Node : public Opaque2Node {
aoqi@0 676 int _opt; // what optimization it was used for
aoqi@0 677 public:
aoqi@0 678 enum { RTM_OPT };
aoqi@0 679 Opaque3Node(Compile* C, Node *n, int opt) : Opaque2Node(C, n), _opt(opt) {}
aoqi@0 680 virtual int Opcode() const;
aoqi@0 681 bool rtm_opt() const { return (_opt == RTM_OPT); }
aoqi@0 682 };
aoqi@0 683
vlivanov@7789 684 //------------------------------ProfileBooleanNode-------------------------------
vlivanov@7789 685 // A node represents value profile for a boolean during parsing.
vlivanov@7789 686 // Once parsing is over, the node goes away (during IGVN).
vlivanov@7789 687 // It is used to override branch frequencies from MDO (see has_injected_profile in parse2.cpp).
vlivanov@7789 688 class ProfileBooleanNode : public Node {
vlivanov@7789 689 uint _false_cnt;
vlivanov@7789 690 uint _true_cnt;
vlivanov@7789 691 bool _consumed;
vlivanov@7789 692 bool _delay_removal;
vlivanov@7789 693 virtual uint hash() const ; // { return NO_HASH; }
vlivanov@7789 694 virtual uint cmp( const Node &n ) const;
vlivanov@7789 695 public:
vlivanov@7789 696 ProfileBooleanNode(Node *n, uint false_cnt, uint true_cnt) : Node(0, n),
vlivanov@7789 697 _false_cnt(false_cnt), _true_cnt(true_cnt), _delay_removal(true), _consumed(false) {}
vlivanov@7789 698
vlivanov@7789 699 uint false_count() const { return _false_cnt; }
vlivanov@7789 700 uint true_count() const { return _true_cnt; }
vlivanov@7789 701
vlivanov@7789 702 void consume() { _consumed = true; }
vlivanov@7789 703
vlivanov@7789 704 virtual int Opcode() const;
vlivanov@7789 705 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
vlivanov@7789 706 virtual Node *Identity(PhaseTransform *phase);
vlivanov@7789 707 virtual const Type *bottom_type() const { return TypeInt::BOOL; }
vlivanov@7789 708 };
aoqi@0 709
aoqi@0 710 //----------------------PartialSubtypeCheckNode--------------------------------
aoqi@0 711 // The 2nd slow-half of a subtype check. Scan the subklass's 2ndary superklass
aoqi@0 712 // array for an instance of the superklass. Set a hidden internal cache on a
aoqi@0 713 // hit (cache is checked with exposed code in gen_subtype_check()). Return
aoqi@0 714 // not zero for a miss or zero for a hit.
aoqi@0 715 class PartialSubtypeCheckNode : public Node {
aoqi@0 716 public:
aoqi@0 717 PartialSubtypeCheckNode(Node* c, Node* sub, Node* super) : Node(c,sub,super) {}
aoqi@0 718 virtual int Opcode() const;
aoqi@0 719 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
aoqi@0 720 virtual uint ideal_reg() const { return Op_RegP; }
aoqi@0 721 };
aoqi@0 722
aoqi@0 723 //
aoqi@0 724 class MoveI2FNode : public Node {
aoqi@0 725 public:
aoqi@0 726 MoveI2FNode( Node *value ) : Node(0,value) {}
aoqi@0 727 virtual int Opcode() const;
aoqi@0 728 virtual const Type *bottom_type() const { return Type::FLOAT; }
aoqi@0 729 virtual uint ideal_reg() const { return Op_RegF; }
aoqi@0 730 virtual const Type* Value( PhaseTransform *phase ) const;
aoqi@0 731 };
aoqi@0 732
aoqi@0 733 class MoveL2DNode : public Node {
aoqi@0 734 public:
aoqi@0 735 MoveL2DNode( Node *value ) : Node(0,value) {}
aoqi@0 736 virtual int Opcode() const;
aoqi@0 737 virtual const Type *bottom_type() const { return Type::DOUBLE; }
aoqi@0 738 virtual uint ideal_reg() const { return Op_RegD; }
aoqi@0 739 virtual const Type* Value( PhaseTransform *phase ) const;
aoqi@0 740 };
aoqi@0 741
aoqi@0 742 class MoveF2INode : public Node {
aoqi@0 743 public:
aoqi@0 744 MoveF2INode( Node *value ) : Node(0,value) {}
aoqi@0 745 virtual int Opcode() const;
aoqi@0 746 virtual const Type *bottom_type() const { return TypeInt::INT; }
aoqi@0 747 virtual uint ideal_reg() const { return Op_RegI; }
aoqi@0 748 virtual const Type* Value( PhaseTransform *phase ) const;
aoqi@0 749 };
aoqi@0 750
aoqi@0 751 class MoveD2LNode : public Node {
aoqi@0 752 public:
aoqi@0 753 MoveD2LNode( Node *value ) : Node(0,value) {}
aoqi@0 754 virtual int Opcode() const;
aoqi@0 755 virtual const Type *bottom_type() const { return TypeLong::LONG; }
aoqi@0 756 virtual uint ideal_reg() const { return Op_RegL; }
aoqi@0 757 virtual const Type* Value( PhaseTransform *phase ) const;
aoqi@0 758 };
aoqi@0 759
aoqi@0 760 //---------- CountBitsNode -----------------------------------------------------
aoqi@0 761 class CountBitsNode : public Node {
aoqi@0 762 public:
aoqi@0 763 CountBitsNode(Node* in1) : Node(0, in1) {}
aoqi@0 764 const Type* bottom_type() const { return TypeInt::INT; }
aoqi@0 765 virtual uint ideal_reg() const { return Op_RegI; }
aoqi@0 766 };
aoqi@0 767
aoqi@0 768 //---------- CountLeadingZerosINode --------------------------------------------
aoqi@0 769 // Count leading zeros (0-bit count starting from MSB) of an integer.
aoqi@0 770 class CountLeadingZerosINode : public CountBitsNode {
aoqi@0 771 public:
aoqi@0 772 CountLeadingZerosINode(Node* in1) : CountBitsNode(in1) {}
aoqi@0 773 virtual int Opcode() const;
aoqi@0 774 virtual const Type* Value(PhaseTransform* phase) const;
aoqi@0 775 };
aoqi@0 776
aoqi@0 777 //---------- CountLeadingZerosLNode --------------------------------------------
aoqi@0 778 // Count leading zeros (0-bit count starting from MSB) of a long.
aoqi@0 779 class CountLeadingZerosLNode : public CountBitsNode {
aoqi@0 780 public:
aoqi@0 781 CountLeadingZerosLNode(Node* in1) : CountBitsNode(in1) {}
aoqi@0 782 virtual int Opcode() const;
aoqi@0 783 virtual const Type* Value(PhaseTransform* phase) const;
aoqi@0 784 };
aoqi@0 785
aoqi@0 786 //---------- CountTrailingZerosINode -------------------------------------------
aoqi@0 787 // Count trailing zeros (0-bit count starting from LSB) of an integer.
aoqi@0 788 class CountTrailingZerosINode : public CountBitsNode {
aoqi@0 789 public:
aoqi@0 790 CountTrailingZerosINode(Node* in1) : CountBitsNode(in1) {}
aoqi@0 791 virtual int Opcode() const;
aoqi@0 792 virtual const Type* Value(PhaseTransform* phase) const;
aoqi@0 793 };
aoqi@0 794
aoqi@0 795 //---------- CountTrailingZerosLNode -------------------------------------------
aoqi@0 796 // Count trailing zeros (0-bit count starting from LSB) of a long.
aoqi@0 797 class CountTrailingZerosLNode : public CountBitsNode {
aoqi@0 798 public:
aoqi@0 799 CountTrailingZerosLNode(Node* in1) : CountBitsNode(in1) {}
aoqi@0 800 virtual int Opcode() const;
aoqi@0 801 virtual const Type* Value(PhaseTransform* phase) const;
aoqi@0 802 };
aoqi@0 803
aoqi@0 804 //---------- PopCountINode -----------------------------------------------------
aoqi@0 805 // Population count (bit count) of an integer.
aoqi@0 806 class PopCountINode : public CountBitsNode {
aoqi@0 807 public:
aoqi@0 808 PopCountINode(Node* in1) : CountBitsNode(in1) {}
aoqi@0 809 virtual int Opcode() const;
aoqi@0 810 };
aoqi@0 811
aoqi@0 812 //---------- PopCountLNode -----------------------------------------------------
aoqi@0 813 // Population count (bit count) of a long.
aoqi@0 814 class PopCountLNode : public CountBitsNode {
aoqi@0 815 public:
aoqi@0 816 PopCountLNode(Node* in1) : CountBitsNode(in1) {}
aoqi@0 817 virtual int Opcode() const;
aoqi@0 818 };
aoqi@0 819
aoqi@0 820 #endif // SHARE_VM_OPTO_CONNODE_HPP

mercurial