1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/opto/connode.hpp Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,768 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +#ifndef SHARE_VM_OPTO_CONNODE_HPP 1.29 +#define SHARE_VM_OPTO_CONNODE_HPP 1.30 + 1.31 +#include "opto/node.hpp" 1.32 +#include "opto/opcodes.hpp" 1.33 +#include "opto/type.hpp" 1.34 + 1.35 +class PhaseTransform; 1.36 +class MachNode; 1.37 + 1.38 +//------------------------------ConNode---------------------------------------- 1.39 +// Simple constants 1.40 +class ConNode : public TypeNode { 1.41 +public: 1.42 + ConNode( const Type *t ) : TypeNode(t->remove_speculative(),1) { 1.43 + init_req(0, (Node*)Compile::current()->root()); 1.44 + init_flags(Flag_is_Con); 1.45 + } 1.46 + virtual int Opcode() const; 1.47 + virtual uint hash() const; 1.48 + virtual const RegMask &out_RegMask() const { return RegMask::Empty; } 1.49 + virtual const RegMask &in_RegMask(uint) const { return RegMask::Empty; } 1.50 + 1.51 + // Polymorphic factory method: 1.52 + static ConNode* make( Compile* C, const Type *t ); 1.53 +}; 1.54 + 1.55 +//------------------------------ConINode--------------------------------------- 1.56 +// Simple integer constants 1.57 +class ConINode : public ConNode { 1.58 +public: 1.59 + ConINode( const TypeInt *t ) : ConNode(t) {} 1.60 + virtual int Opcode() const; 1.61 + 1.62 + // Factory method: 1.63 + static ConINode* make( Compile* C, int con ) { 1.64 + return new (C) ConINode( TypeInt::make(con) ); 1.65 + } 1.66 + 1.67 +}; 1.68 + 1.69 +//------------------------------ConPNode--------------------------------------- 1.70 +// Simple pointer constants 1.71 +class ConPNode : public ConNode { 1.72 +public: 1.73 + ConPNode( const TypePtr *t ) : ConNode(t) {} 1.74 + virtual int Opcode() const; 1.75 + 1.76 + // Factory methods: 1.77 + static ConPNode* make( Compile *C ,address con ) { 1.78 + if (con == NULL) 1.79 + return new (C) ConPNode( TypePtr::NULL_PTR ) ; 1.80 + else 1.81 + return new (C) ConPNode( TypeRawPtr::make(con) ); 1.82 + } 1.83 +}; 1.84 + 1.85 + 1.86 +//------------------------------ConNNode-------------------------------------- 1.87 +// Simple narrow oop constants 1.88 +class ConNNode : public ConNode { 1.89 +public: 1.90 + ConNNode( const TypeNarrowOop *t ) : ConNode(t) {} 1.91 + virtual int Opcode() const; 1.92 +}; 1.93 + 1.94 +//------------------------------ConNKlassNode--------------------------------- 1.95 +// Simple narrow klass constants 1.96 +class ConNKlassNode : public ConNode { 1.97 +public: 1.98 + ConNKlassNode( const TypeNarrowKlass *t ) : ConNode(t) {} 1.99 + virtual int Opcode() const; 1.100 +}; 1.101 + 1.102 + 1.103 +//------------------------------ConLNode--------------------------------------- 1.104 +// Simple long constants 1.105 +class ConLNode : public ConNode { 1.106 +public: 1.107 + ConLNode( const TypeLong *t ) : ConNode(t) {} 1.108 + virtual int Opcode() const; 1.109 + 1.110 + // Factory method: 1.111 + static ConLNode* make( Compile *C ,jlong con ) { 1.112 + return new (C) ConLNode( TypeLong::make(con) ); 1.113 + } 1.114 + 1.115 +}; 1.116 + 1.117 +//------------------------------ConFNode--------------------------------------- 1.118 +// Simple float constants 1.119 +class ConFNode : public ConNode { 1.120 +public: 1.121 + ConFNode( const TypeF *t ) : ConNode(t) {} 1.122 + virtual int Opcode() const; 1.123 + 1.124 + // Factory method: 1.125 + static ConFNode* make( Compile *C, float con ) { 1.126 + return new (C) ConFNode( TypeF::make(con) ); 1.127 + } 1.128 + 1.129 +}; 1.130 + 1.131 +//------------------------------ConDNode--------------------------------------- 1.132 +// Simple double constants 1.133 +class ConDNode : public ConNode { 1.134 +public: 1.135 + ConDNode( const TypeD *t ) : ConNode(t) {} 1.136 + virtual int Opcode() const; 1.137 + 1.138 + // Factory method: 1.139 + static ConDNode* make( Compile *C, double con ) { 1.140 + return new (C) ConDNode( TypeD::make(con) ); 1.141 + } 1.142 + 1.143 +}; 1.144 + 1.145 +//------------------------------BinaryNode------------------------------------- 1.146 +// Place holder for the 2 conditional inputs to a CMove. CMove needs 4 1.147 +// inputs: the Bool (for the lt/gt/eq/ne bits), the flags (result of some 1.148 +// compare), and the 2 values to select between. The Matcher requires a 1.149 +// binary tree so we break it down like this: 1.150 +// (CMove (Binary bol cmp) (Binary src1 src2)) 1.151 +class BinaryNode : public Node { 1.152 +public: 1.153 + BinaryNode( Node *n1, Node *n2 ) : Node(0,n1,n2) { } 1.154 + virtual int Opcode() const; 1.155 + virtual uint ideal_reg() const { return 0; } 1.156 +}; 1.157 + 1.158 +//------------------------------CMoveNode-------------------------------------- 1.159 +// Conditional move 1.160 +class CMoveNode : public TypeNode { 1.161 +public: 1.162 + enum { Control, // When is it safe to do this cmove? 1.163 + Condition, // Condition controlling the cmove 1.164 + IfFalse, // Value if condition is false 1.165 + IfTrue }; // Value if condition is true 1.166 + CMoveNode( Node *bol, Node *left, Node *right, const Type *t ) : TypeNode(t,4) 1.167 + { 1.168 + init_class_id(Class_CMove); 1.169 + // all inputs are nullified in Node::Node(int) 1.170 + // init_req(Control,NULL); 1.171 + init_req(Condition,bol); 1.172 + init_req(IfFalse,left); 1.173 + init_req(IfTrue,right); 1.174 + } 1.175 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 1.176 + virtual const Type *Value( PhaseTransform *phase ) const; 1.177 + virtual Node *Identity( PhaseTransform *phase ); 1.178 + static CMoveNode *make( Compile *C, Node *c, Node *bol, Node *left, Node *right, const Type *t ); 1.179 + // Helper function to spot cmove graph shapes 1.180 + static Node *is_cmove_id( PhaseTransform *phase, Node *cmp, Node *t, Node *f, BoolNode *b ); 1.181 +}; 1.182 + 1.183 +//------------------------------CMoveDNode------------------------------------- 1.184 +class CMoveDNode : public CMoveNode { 1.185 +public: 1.186 + CMoveDNode( Node *bol, Node *left, Node *right, const Type* t) : CMoveNode(bol,left,right,t){} 1.187 + virtual int Opcode() const; 1.188 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 1.189 +}; 1.190 + 1.191 +//------------------------------CMoveFNode------------------------------------- 1.192 +class CMoveFNode : public CMoveNode { 1.193 +public: 1.194 + CMoveFNode( Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) {} 1.195 + virtual int Opcode() const; 1.196 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 1.197 +}; 1.198 + 1.199 +//------------------------------CMoveINode------------------------------------- 1.200 +class CMoveINode : public CMoveNode { 1.201 +public: 1.202 + CMoveINode( Node *bol, Node *left, Node *right, const TypeInt *ti ) : CMoveNode(bol,left,right,ti){} 1.203 + virtual int Opcode() const; 1.204 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 1.205 +}; 1.206 + 1.207 +//------------------------------CMoveLNode------------------------------------- 1.208 +class CMoveLNode : public CMoveNode { 1.209 +public: 1.210 + CMoveLNode(Node *bol, Node *left, Node *right, const TypeLong *tl ) : CMoveNode(bol,left,right,tl){} 1.211 + virtual int Opcode() const; 1.212 +}; 1.213 + 1.214 +//------------------------------CMovePNode------------------------------------- 1.215 +class CMovePNode : public CMoveNode { 1.216 +public: 1.217 + CMovePNode( Node *c, Node *bol, Node *left, Node *right, const TypePtr* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); } 1.218 + virtual int Opcode() const; 1.219 +}; 1.220 + 1.221 +//------------------------------CMoveNNode------------------------------------- 1.222 +class CMoveNNode : public CMoveNode { 1.223 +public: 1.224 + CMoveNNode( Node *c, Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); } 1.225 + virtual int Opcode() const; 1.226 +}; 1.227 + 1.228 +//------------------------------ConstraintCastNode----------------------------- 1.229 +// cast to a different range 1.230 +class ConstraintCastNode: public TypeNode { 1.231 +public: 1.232 + ConstraintCastNode (Node *n, const Type *t ): TypeNode(t,2) { 1.233 + init_class_id(Class_ConstraintCast); 1.234 + init_req(1, n); 1.235 + } 1.236 + virtual Node *Identity( PhaseTransform *phase ); 1.237 + virtual const Type *Value( PhaseTransform *phase ) const; 1.238 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 1.239 + virtual int Opcode() const; 1.240 + virtual uint ideal_reg() const = 0; 1.241 + virtual Node *Ideal_DU_postCCP( PhaseCCP * ); 1.242 +}; 1.243 + 1.244 +//------------------------------CastIINode------------------------------------- 1.245 +// cast integer to integer (different range) 1.246 +class CastIINode: public ConstraintCastNode { 1.247 +public: 1.248 + CastIINode (Node *n, const Type *t ): ConstraintCastNode(n,t) {} 1.249 + virtual int Opcode() const; 1.250 + virtual uint ideal_reg() const { return Op_RegI; } 1.251 +}; 1.252 + 1.253 +//------------------------------CastPPNode------------------------------------- 1.254 +// cast pointer to pointer (different type) 1.255 +class CastPPNode: public ConstraintCastNode { 1.256 +public: 1.257 + CastPPNode (Node *n, const Type *t ): ConstraintCastNode(n, t) {} 1.258 + virtual int Opcode() const; 1.259 + virtual uint ideal_reg() const { return Op_RegP; } 1.260 + virtual Node *Ideal_DU_postCCP( PhaseCCP * ); 1.261 +}; 1.262 + 1.263 +//------------------------------CheckCastPPNode-------------------------------- 1.264 +// for _checkcast, cast pointer to pointer (different type), without JOIN, 1.265 +class CheckCastPPNode: public TypeNode { 1.266 +public: 1.267 + CheckCastPPNode( Node *c, Node *n, const Type *t ) : TypeNode(t,2) { 1.268 + init_class_id(Class_CheckCastPP); 1.269 + init_req(0, c); 1.270 + init_req(1, n); 1.271 + } 1.272 + 1.273 + virtual Node *Identity( PhaseTransform *phase ); 1.274 + virtual const Type *Value( PhaseTransform *phase ) const; 1.275 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 1.276 + virtual int Opcode() const; 1.277 + virtual uint ideal_reg() const { return Op_RegP; } 1.278 + // No longer remove CheckCast after CCP as it gives me a place to hang 1.279 + // the proper address type - which is required to compute anti-deps. 1.280 + //virtual Node *Ideal_DU_postCCP( PhaseCCP * ); 1.281 +}; 1.282 + 1.283 + 1.284 +//------------------------------EncodeNarrowPtr-------------------------------- 1.285 +class EncodeNarrowPtrNode : public TypeNode { 1.286 + protected: 1.287 + EncodeNarrowPtrNode(Node* value, const Type* type): 1.288 + TypeNode(type, 2) { 1.289 + init_class_id(Class_EncodeNarrowPtr); 1.290 + init_req(0, NULL); 1.291 + init_req(1, value); 1.292 + } 1.293 + public: 1.294 + virtual uint ideal_reg() const { return Op_RegN; } 1.295 + virtual Node *Ideal_DU_postCCP( PhaseCCP *ccp ); 1.296 +}; 1.297 + 1.298 +//------------------------------EncodeP-------------------------------- 1.299 +// Encodes an oop pointers into its compressed form 1.300 +// Takes an extra argument which is the real heap base as a long which 1.301 +// may be useful for code generation in the backend. 1.302 +class EncodePNode : public EncodeNarrowPtrNode { 1.303 + public: 1.304 + EncodePNode(Node* value, const Type* type): 1.305 + EncodeNarrowPtrNode(value, type) { 1.306 + init_class_id(Class_EncodeP); 1.307 + } 1.308 + virtual int Opcode() const; 1.309 + virtual Node *Identity( PhaseTransform *phase ); 1.310 + virtual const Type *Value( PhaseTransform *phase ) const; 1.311 +}; 1.312 + 1.313 +//------------------------------EncodePKlass-------------------------------- 1.314 +// Encodes a klass pointer into its compressed form 1.315 +// Takes an extra argument which is the real heap base as a long which 1.316 +// may be useful for code generation in the backend. 1.317 +class EncodePKlassNode : public EncodeNarrowPtrNode { 1.318 + public: 1.319 + EncodePKlassNode(Node* value, const Type* type): 1.320 + EncodeNarrowPtrNode(value, type) { 1.321 + init_class_id(Class_EncodePKlass); 1.322 + } 1.323 + virtual int Opcode() const; 1.324 + virtual Node *Identity( PhaseTransform *phase ); 1.325 + virtual const Type *Value( PhaseTransform *phase ) const; 1.326 +}; 1.327 + 1.328 +//------------------------------DecodeNarrowPtr-------------------------------- 1.329 +class DecodeNarrowPtrNode : public TypeNode { 1.330 + protected: 1.331 + DecodeNarrowPtrNode(Node* value, const Type* type): 1.332 + TypeNode(type, 2) { 1.333 + init_class_id(Class_DecodeNarrowPtr); 1.334 + init_req(0, NULL); 1.335 + init_req(1, value); 1.336 + } 1.337 + public: 1.338 + virtual uint ideal_reg() const { return Op_RegP; } 1.339 +}; 1.340 + 1.341 +//------------------------------DecodeN-------------------------------- 1.342 +// Converts a narrow oop into a real oop ptr. 1.343 +// Takes an extra argument which is the real heap base as a long which 1.344 +// may be useful for code generation in the backend. 1.345 +class DecodeNNode : public DecodeNarrowPtrNode { 1.346 + public: 1.347 + DecodeNNode(Node* value, const Type* type): 1.348 + DecodeNarrowPtrNode(value, type) { 1.349 + init_class_id(Class_DecodeN); 1.350 + } 1.351 + virtual int Opcode() const; 1.352 + virtual const Type *Value( PhaseTransform *phase ) const; 1.353 + virtual Node *Identity( PhaseTransform *phase ); 1.354 +}; 1.355 + 1.356 +//------------------------------DecodeNKlass-------------------------------- 1.357 +// Converts a narrow klass pointer into a real klass ptr. 1.358 +// Takes an extra argument which is the real heap base as a long which 1.359 +// may be useful for code generation in the backend. 1.360 +class DecodeNKlassNode : public DecodeNarrowPtrNode { 1.361 + public: 1.362 + DecodeNKlassNode(Node* value, const Type* type): 1.363 + DecodeNarrowPtrNode(value, type) { 1.364 + init_class_id(Class_DecodeNKlass); 1.365 + } 1.366 + virtual int Opcode() const; 1.367 + virtual const Type *Value( PhaseTransform *phase ) const; 1.368 + virtual Node *Identity( PhaseTransform *phase ); 1.369 +}; 1.370 + 1.371 +//------------------------------Conv2BNode------------------------------------- 1.372 +// Convert int/pointer to a Boolean. Map zero to zero, all else to 1. 1.373 +class Conv2BNode : public Node { 1.374 +public: 1.375 + Conv2BNode( Node *i ) : Node(0,i) {} 1.376 + virtual int Opcode() const; 1.377 + virtual const Type *bottom_type() const { return TypeInt::BOOL; } 1.378 + virtual Node *Identity( PhaseTransform *phase ); 1.379 + virtual const Type *Value( PhaseTransform *phase ) const; 1.380 + virtual uint ideal_reg() const { return Op_RegI; } 1.381 +}; 1.382 + 1.383 +// The conversions operations are all Alpha sorted. Please keep it that way! 1.384 +//------------------------------ConvD2FNode------------------------------------ 1.385 +// Convert double to float 1.386 +class ConvD2FNode : public Node { 1.387 +public: 1.388 + ConvD2FNode( Node *in1 ) : Node(0,in1) {} 1.389 + virtual int Opcode() const; 1.390 + virtual const Type *bottom_type() const { return Type::FLOAT; } 1.391 + virtual const Type *Value( PhaseTransform *phase ) const; 1.392 + virtual Node *Identity( PhaseTransform *phase ); 1.393 + virtual uint ideal_reg() const { return Op_RegF; } 1.394 +}; 1.395 + 1.396 +//------------------------------ConvD2INode------------------------------------ 1.397 +// Convert Double to Integer 1.398 +class ConvD2INode : public Node { 1.399 +public: 1.400 + ConvD2INode( Node *in1 ) : Node(0,in1) {} 1.401 + virtual int Opcode() const; 1.402 + virtual const Type *bottom_type() const { return TypeInt::INT; } 1.403 + virtual const Type *Value( PhaseTransform *phase ) const; 1.404 + virtual Node *Identity( PhaseTransform *phase ); 1.405 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 1.406 + virtual uint ideal_reg() const { return Op_RegI; } 1.407 +}; 1.408 + 1.409 +//------------------------------ConvD2LNode------------------------------------ 1.410 +// Convert Double to Long 1.411 +class ConvD2LNode : public Node { 1.412 +public: 1.413 + ConvD2LNode( Node *dbl ) : Node(0,dbl) {} 1.414 + virtual int Opcode() const; 1.415 + virtual const Type *bottom_type() const { return TypeLong::LONG; } 1.416 + virtual const Type *Value( PhaseTransform *phase ) const; 1.417 + virtual Node *Identity( PhaseTransform *phase ); 1.418 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 1.419 + virtual uint ideal_reg() const { return Op_RegL; } 1.420 +}; 1.421 + 1.422 +//------------------------------ConvF2DNode------------------------------------ 1.423 +// Convert Float to a Double. 1.424 +class ConvF2DNode : public Node { 1.425 +public: 1.426 + ConvF2DNode( Node *in1 ) : Node(0,in1) {} 1.427 + virtual int Opcode() const; 1.428 + virtual const Type *bottom_type() const { return Type::DOUBLE; } 1.429 + virtual const Type *Value( PhaseTransform *phase ) const; 1.430 + virtual uint ideal_reg() const { return Op_RegD; } 1.431 +}; 1.432 + 1.433 +//------------------------------ConvF2INode------------------------------------ 1.434 +// Convert float to integer 1.435 +class ConvF2INode : public Node { 1.436 +public: 1.437 + ConvF2INode( Node *in1 ) : Node(0,in1) {} 1.438 + virtual int Opcode() const; 1.439 + virtual const Type *bottom_type() const { return TypeInt::INT; } 1.440 + virtual const Type *Value( PhaseTransform *phase ) const; 1.441 + virtual Node *Identity( PhaseTransform *phase ); 1.442 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 1.443 + virtual uint ideal_reg() const { return Op_RegI; } 1.444 +}; 1.445 + 1.446 +//------------------------------ConvF2LNode------------------------------------ 1.447 +// Convert float to long 1.448 +class ConvF2LNode : public Node { 1.449 +public: 1.450 + ConvF2LNode( Node *in1 ) : Node(0,in1) {} 1.451 + virtual int Opcode() const; 1.452 + virtual const Type *bottom_type() const { return TypeLong::LONG; } 1.453 + virtual const Type *Value( PhaseTransform *phase ) const; 1.454 + virtual Node *Identity( PhaseTransform *phase ); 1.455 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 1.456 + virtual uint ideal_reg() const { return Op_RegL; } 1.457 +}; 1.458 + 1.459 +//------------------------------ConvI2DNode------------------------------------ 1.460 +// Convert Integer to Double 1.461 +class ConvI2DNode : public Node { 1.462 +public: 1.463 + ConvI2DNode( Node *in1 ) : Node(0,in1) {} 1.464 + virtual int Opcode() const; 1.465 + virtual const Type *bottom_type() const { return Type::DOUBLE; } 1.466 + virtual const Type *Value( PhaseTransform *phase ) const; 1.467 + virtual uint ideal_reg() const { return Op_RegD; } 1.468 +}; 1.469 + 1.470 +//------------------------------ConvI2FNode------------------------------------ 1.471 +// Convert Integer to Float 1.472 +class ConvI2FNode : public Node { 1.473 +public: 1.474 + ConvI2FNode( Node *in1 ) : Node(0,in1) {} 1.475 + virtual int Opcode() const; 1.476 + virtual const Type *bottom_type() const { return Type::FLOAT; } 1.477 + virtual const Type *Value( PhaseTransform *phase ) const; 1.478 + virtual Node *Identity( PhaseTransform *phase ); 1.479 + virtual uint ideal_reg() const { return Op_RegF; } 1.480 +}; 1.481 + 1.482 +//------------------------------ConvI2LNode------------------------------------ 1.483 +// Convert integer to long 1.484 +class ConvI2LNode : public TypeNode { 1.485 +public: 1.486 + ConvI2LNode(Node *in1, const TypeLong* t = TypeLong::INT) 1.487 + : TypeNode(t, 2) 1.488 + { init_req(1, in1); } 1.489 + virtual int Opcode() const; 1.490 + virtual const Type *Value( PhaseTransform *phase ) const; 1.491 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 1.492 + virtual uint ideal_reg() const { return Op_RegL; } 1.493 +}; 1.494 + 1.495 +//------------------------------ConvL2DNode------------------------------------ 1.496 +// Convert Long to Double 1.497 +class ConvL2DNode : public Node { 1.498 +public: 1.499 + ConvL2DNode( Node *in1 ) : Node(0,in1) {} 1.500 + virtual int Opcode() const; 1.501 + virtual const Type *bottom_type() const { return Type::DOUBLE; } 1.502 + virtual const Type *Value( PhaseTransform *phase ) const; 1.503 + virtual uint ideal_reg() const { return Op_RegD; } 1.504 +}; 1.505 + 1.506 +//------------------------------ConvL2FNode------------------------------------ 1.507 +// Convert Long to Float 1.508 +class ConvL2FNode : public Node { 1.509 +public: 1.510 + ConvL2FNode( Node *in1 ) : Node(0,in1) {} 1.511 + virtual int Opcode() const; 1.512 + virtual const Type *bottom_type() const { return Type::FLOAT; } 1.513 + virtual const Type *Value( PhaseTransform *phase ) const; 1.514 + virtual uint ideal_reg() const { return Op_RegF; } 1.515 +}; 1.516 + 1.517 +//------------------------------ConvL2INode------------------------------------ 1.518 +// Convert long to integer 1.519 +class ConvL2INode : public Node { 1.520 +public: 1.521 + ConvL2INode( Node *in1 ) : Node(0,in1) {} 1.522 + virtual int Opcode() const; 1.523 + virtual const Type *bottom_type() const { return TypeInt::INT; } 1.524 + virtual Node *Identity( PhaseTransform *phase ); 1.525 + virtual const Type *Value( PhaseTransform *phase ) const; 1.526 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 1.527 + virtual uint ideal_reg() const { return Op_RegI; } 1.528 +}; 1.529 + 1.530 +//------------------------------CastX2PNode------------------------------------- 1.531 +// convert a machine-pointer-sized integer to a raw pointer 1.532 +class CastX2PNode : public Node { 1.533 +public: 1.534 + CastX2PNode( Node *n ) : Node(NULL, n) {} 1.535 + virtual int Opcode() const; 1.536 + virtual const Type *Value( PhaseTransform *phase ) const; 1.537 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 1.538 + virtual Node *Identity( PhaseTransform *phase ); 1.539 + virtual uint ideal_reg() const { return Op_RegP; } 1.540 + virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; } 1.541 +}; 1.542 + 1.543 +//------------------------------CastP2XNode------------------------------------- 1.544 +// Used in both 32-bit and 64-bit land. 1.545 +// Used for card-marks and unsafe pointer math. 1.546 +class CastP2XNode : public Node { 1.547 +public: 1.548 + CastP2XNode( Node *ctrl, Node *n ) : Node(ctrl, n) {} 1.549 + virtual int Opcode() const; 1.550 + virtual const Type *Value( PhaseTransform *phase ) const; 1.551 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 1.552 + virtual Node *Identity( PhaseTransform *phase ); 1.553 + virtual uint ideal_reg() const { return Op_RegX; } 1.554 + virtual const Type *bottom_type() const { return TypeX_X; } 1.555 + // Return false to keep node from moving away from an associated card mark. 1.556 + virtual bool depends_only_on_test() const { return false; } 1.557 +}; 1.558 + 1.559 +//------------------------------ThreadLocalNode-------------------------------- 1.560 +// Ideal Node which returns the base of ThreadLocalStorage. 1.561 +class ThreadLocalNode : public Node { 1.562 +public: 1.563 + ThreadLocalNode( ) : Node((Node*)Compile::current()->root()) {} 1.564 + virtual int Opcode() const; 1.565 + virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM;} 1.566 + virtual uint ideal_reg() const { return Op_RegP; } 1.567 +}; 1.568 + 1.569 +//------------------------------LoadReturnPCNode------------------------------- 1.570 +class LoadReturnPCNode: public Node { 1.571 +public: 1.572 + LoadReturnPCNode(Node *c) : Node(c) { } 1.573 + virtual int Opcode() const; 1.574 + virtual uint ideal_reg() const { return Op_RegP; } 1.575 +}; 1.576 + 1.577 + 1.578 +//-----------------------------RoundFloatNode---------------------------------- 1.579 +class RoundFloatNode: public Node { 1.580 +public: 1.581 + RoundFloatNode(Node* c, Node *in1): Node(c, in1) {} 1.582 + virtual int Opcode() const; 1.583 + virtual const Type *bottom_type() const { return Type::FLOAT; } 1.584 + virtual uint ideal_reg() const { return Op_RegF; } 1.585 + virtual Node *Identity( PhaseTransform *phase ); 1.586 + virtual const Type *Value( PhaseTransform *phase ) const; 1.587 +}; 1.588 + 1.589 + 1.590 +//-----------------------------RoundDoubleNode--------------------------------- 1.591 +class RoundDoubleNode: public Node { 1.592 +public: 1.593 + RoundDoubleNode(Node* c, Node *in1): Node(c, in1) {} 1.594 + virtual int Opcode() const; 1.595 + virtual const Type *bottom_type() const { return Type::DOUBLE; } 1.596 + virtual uint ideal_reg() const { return Op_RegD; } 1.597 + virtual Node *Identity( PhaseTransform *phase ); 1.598 + virtual const Type *Value( PhaseTransform *phase ) const; 1.599 +}; 1.600 + 1.601 +//------------------------------Opaque1Node------------------------------------ 1.602 +// A node to prevent unwanted optimizations. Allows constant folding. 1.603 +// Stops value-numbering, Ideal calls or Identity functions. 1.604 +class Opaque1Node : public Node { 1.605 + virtual uint hash() const ; // { return NO_HASH; } 1.606 + virtual uint cmp( const Node &n ) const; 1.607 +public: 1.608 + Opaque1Node( Compile* C, Node *n ) : Node(0,n) { 1.609 + // Put it on the Macro nodes list to removed during macro nodes expansion. 1.610 + init_flags(Flag_is_macro); 1.611 + C->add_macro_node(this); 1.612 + } 1.613 + // Special version for the pre-loop to hold the original loop limit 1.614 + // which is consumed by range check elimination. 1.615 + Opaque1Node( Compile* C, Node *n, Node* orig_limit ) : Node(0,n,orig_limit) { 1.616 + // Put it on the Macro nodes list to removed during macro nodes expansion. 1.617 + init_flags(Flag_is_macro); 1.618 + C->add_macro_node(this); 1.619 + } 1.620 + Node* original_loop_limit() { return req()==3 ? in(2) : NULL; } 1.621 + virtual int Opcode() const; 1.622 + virtual const Type *bottom_type() const { return TypeInt::INT; } 1.623 + virtual Node *Identity( PhaseTransform *phase ); 1.624 +}; 1.625 + 1.626 +//------------------------------Opaque2Node------------------------------------ 1.627 +// A node to prevent unwanted optimizations. Allows constant folding. Stops 1.628 +// value-numbering, most Ideal calls or Identity functions. This Node is 1.629 +// specifically designed to prevent the pre-increment value of a loop trip 1.630 +// counter from being live out of the bottom of the loop (hence causing the 1.631 +// pre- and post-increment values both being live and thus requiring an extra 1.632 +// temp register and an extra move). If we "accidentally" optimize through 1.633 +// this kind of a Node, we'll get slightly pessimal, but correct, code. Thus 1.634 +// it's OK to be slightly sloppy on optimizations here. 1.635 +class Opaque2Node : public Node { 1.636 + virtual uint hash() const ; // { return NO_HASH; } 1.637 + virtual uint cmp( const Node &n ) const; 1.638 +public: 1.639 + Opaque2Node( Compile* C, Node *n ) : Node(0,n) { 1.640 + // Put it on the Macro nodes list to removed during macro nodes expansion. 1.641 + init_flags(Flag_is_macro); 1.642 + C->add_macro_node(this); 1.643 + } 1.644 + virtual int Opcode() const; 1.645 + virtual const Type *bottom_type() const { return TypeInt::INT; } 1.646 +}; 1.647 + 1.648 +//------------------------------Opaque3Node------------------------------------ 1.649 +// A node to prevent unwanted optimizations. Will be optimized only during 1.650 +// macro nodes expansion. 1.651 +class Opaque3Node : public Opaque2Node { 1.652 + int _opt; // what optimization it was used for 1.653 +public: 1.654 + enum { RTM_OPT }; 1.655 + Opaque3Node(Compile* C, Node *n, int opt) : Opaque2Node(C, n), _opt(opt) {} 1.656 + virtual int Opcode() const; 1.657 + bool rtm_opt() const { return (_opt == RTM_OPT); } 1.658 +}; 1.659 + 1.660 + 1.661 +//----------------------PartialSubtypeCheckNode-------------------------------- 1.662 +// The 2nd slow-half of a subtype check. Scan the subklass's 2ndary superklass 1.663 +// array for an instance of the superklass. Set a hidden internal cache on a 1.664 +// hit (cache is checked with exposed code in gen_subtype_check()). Return 1.665 +// not zero for a miss or zero for a hit. 1.666 +class PartialSubtypeCheckNode : public Node { 1.667 +public: 1.668 + PartialSubtypeCheckNode(Node* c, Node* sub, Node* super) : Node(c,sub,super) {} 1.669 + virtual int Opcode() const; 1.670 + virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; } 1.671 + virtual uint ideal_reg() const { return Op_RegP; } 1.672 +}; 1.673 + 1.674 +// 1.675 +class MoveI2FNode : public Node { 1.676 + public: 1.677 + MoveI2FNode( Node *value ) : Node(0,value) {} 1.678 + virtual int Opcode() const; 1.679 + virtual const Type *bottom_type() const { return Type::FLOAT; } 1.680 + virtual uint ideal_reg() const { return Op_RegF; } 1.681 + virtual const Type* Value( PhaseTransform *phase ) const; 1.682 +}; 1.683 + 1.684 +class MoveL2DNode : public Node { 1.685 + public: 1.686 + MoveL2DNode( Node *value ) : Node(0,value) {} 1.687 + virtual int Opcode() const; 1.688 + virtual const Type *bottom_type() const { return Type::DOUBLE; } 1.689 + virtual uint ideal_reg() const { return Op_RegD; } 1.690 + virtual const Type* Value( PhaseTransform *phase ) const; 1.691 +}; 1.692 + 1.693 +class MoveF2INode : public Node { 1.694 + public: 1.695 + MoveF2INode( Node *value ) : Node(0,value) {} 1.696 + virtual int Opcode() const; 1.697 + virtual const Type *bottom_type() const { return TypeInt::INT; } 1.698 + virtual uint ideal_reg() const { return Op_RegI; } 1.699 + virtual const Type* Value( PhaseTransform *phase ) const; 1.700 +}; 1.701 + 1.702 +class MoveD2LNode : public Node { 1.703 + public: 1.704 + MoveD2LNode( Node *value ) : Node(0,value) {} 1.705 + virtual int Opcode() const; 1.706 + virtual const Type *bottom_type() const { return TypeLong::LONG; } 1.707 + virtual uint ideal_reg() const { return Op_RegL; } 1.708 + virtual const Type* Value( PhaseTransform *phase ) const; 1.709 +}; 1.710 + 1.711 +//---------- CountBitsNode ----------------------------------------------------- 1.712 +class CountBitsNode : public Node { 1.713 +public: 1.714 + CountBitsNode(Node* in1) : Node(0, in1) {} 1.715 + const Type* bottom_type() const { return TypeInt::INT; } 1.716 + virtual uint ideal_reg() const { return Op_RegI; } 1.717 +}; 1.718 + 1.719 +//---------- CountLeadingZerosINode -------------------------------------------- 1.720 +// Count leading zeros (0-bit count starting from MSB) of an integer. 1.721 +class CountLeadingZerosINode : public CountBitsNode { 1.722 +public: 1.723 + CountLeadingZerosINode(Node* in1) : CountBitsNode(in1) {} 1.724 + virtual int Opcode() const; 1.725 + virtual const Type* Value(PhaseTransform* phase) const; 1.726 +}; 1.727 + 1.728 +//---------- CountLeadingZerosLNode -------------------------------------------- 1.729 +// Count leading zeros (0-bit count starting from MSB) of a long. 1.730 +class CountLeadingZerosLNode : public CountBitsNode { 1.731 +public: 1.732 + CountLeadingZerosLNode(Node* in1) : CountBitsNode(in1) {} 1.733 + virtual int Opcode() const; 1.734 + virtual const Type* Value(PhaseTransform* phase) const; 1.735 +}; 1.736 + 1.737 +//---------- CountTrailingZerosINode ------------------------------------------- 1.738 +// Count trailing zeros (0-bit count starting from LSB) of an integer. 1.739 +class CountTrailingZerosINode : public CountBitsNode { 1.740 +public: 1.741 + CountTrailingZerosINode(Node* in1) : CountBitsNode(in1) {} 1.742 + virtual int Opcode() const; 1.743 + virtual const Type* Value(PhaseTransform* phase) const; 1.744 +}; 1.745 + 1.746 +//---------- CountTrailingZerosLNode ------------------------------------------- 1.747 +// Count trailing zeros (0-bit count starting from LSB) of a long. 1.748 +class CountTrailingZerosLNode : public CountBitsNode { 1.749 +public: 1.750 + CountTrailingZerosLNode(Node* in1) : CountBitsNode(in1) {} 1.751 + virtual int Opcode() const; 1.752 + virtual const Type* Value(PhaseTransform* phase) const; 1.753 +}; 1.754 + 1.755 +//---------- PopCountINode ----------------------------------------------------- 1.756 +// Population count (bit count) of an integer. 1.757 +class PopCountINode : public CountBitsNode { 1.758 +public: 1.759 + PopCountINode(Node* in1) : CountBitsNode(in1) {} 1.760 + virtual int Opcode() const; 1.761 +}; 1.762 + 1.763 +//---------- PopCountLNode ----------------------------------------------------- 1.764 +// Population count (bit count) of a long. 1.765 +class PopCountLNode : public CountBitsNode { 1.766 +public: 1.767 + PopCountLNode(Node* in1) : CountBitsNode(in1) {} 1.768 + virtual int Opcode() const; 1.769 +}; 1.770 + 1.771 +#endif // SHARE_VM_OPTO_CONNODE_HPP