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