src/share/vm/opto/connode.hpp

Tue, 08 Aug 2017 15:57:29 +0800

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

mercurial