1 /*
  2  * Copyright (c) 1997, 2022, 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_OPTO_SUBNODE_HPP
 26 #define SHARE_OPTO_SUBNODE_HPP
 27 
 28 #include "opto/node.hpp"
 29 #include "opto/opcodes.hpp"
 30 #include "opto/type.hpp"
 31 
 32 // Portions of code courtesy of Clifford Click
 33 
 34 //------------------------------SUBNode----------------------------------------
 35 // Class SUBTRACTION functionality.  This covers all the usual 'subtract'
 36 // behaviors.  Subtract-integer, -float, -double, binary xor, compare-integer,
 37 // -float, and -double are all inherited from this class.  The compare
 38 // functions behave like subtract functions, except that all negative answers
 39 // are compressed into -1, and all positive answers compressed to 1.
 40 class SubNode : public Node {
 41 public:
 42   SubNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {
 43     init_class_id(Class_Sub);
 44   }
 45 
 46   // Handle algebraic identities here.  If we have an identity, return the Node
 47   // we are equivalent to.  We look for "add of zero" as an identity.
 48   virtual Node* Identity(PhaseGVN* phase);
 49 
 50   // Compute a new Type for this node.  Basically we just do the pre-check,
 51   // then call the virtual add() to set the type.
 52   virtual const Type* Value(PhaseGVN* phase) const;
 53   const Type* Value_common( PhaseTransform *phase ) const;
 54 
 55   // Supplied function returns the subtractend of the inputs.
 56   // This also type-checks the inputs for sanity.  Guaranteed never to
 57   // be passed a TOP or BOTTOM type, these are filtered out by a pre-check.
 58   virtual const Type *sub( const Type *, const Type * ) const = 0;
 59 
 60   // Supplied function to return the additive identity type.
 61   // This is returned whenever the subtracts inputs are the same.
 62   virtual const Type *add_id() const = 0;
 63 
 64   static SubNode* make(Node* in1, Node* in2, BasicType bt);
 65 };
 66 
 67 
 68 // NOTE: SubINode should be taken away and replaced by add and negate
 69 //------------------------------SubINode---------------------------------------
 70 // Subtract 2 integers
 71 class SubINode : public SubNode {
 72 public:
 73   SubINode( Node *in1, Node *in2 ) : SubNode(in1,in2) {}
 74   virtual int Opcode() const;
 75   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 76   virtual const Type *sub( const Type *, const Type * ) const;
 77   const Type *add_id() const { return TypeInt::ZERO; }
 78   const Type *bottom_type() const { return TypeInt::INT; }
 79   virtual uint ideal_reg() const { return Op_RegI; }
 80 };
 81 
 82 //------------------------------SubLNode---------------------------------------
 83 // Subtract 2 integers
 84 class SubLNode : public SubNode {
 85 public:
 86   SubLNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {}
 87   virtual int Opcode() const;
 88   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 89   virtual const Type *sub( const Type *, const Type * ) const;
 90   const Type *add_id() const { return TypeLong::ZERO; }
 91   const Type *bottom_type() const { return TypeLong::LONG; }
 92   virtual uint ideal_reg() const { return Op_RegL; }
 93 };
 94 
 95 // NOTE: SubFPNode should be taken away and replaced by add and negate
 96 //------------------------------SubFPNode--------------------------------------
 97 // Subtract 2 floats or doubles
 98 class SubFPNode : public SubNode {
 99 protected:
100   SubFPNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {}
101 public:
102   const Type* Value(PhaseGVN* phase) const;
103 };
104 
105 // NOTE: SubFNode should be taken away and replaced by add and negate
106 //------------------------------SubFNode---------------------------------------
107 // Subtract 2 doubles
108 class SubFNode : public SubFPNode {
109 public:
110   SubFNode( Node *in1, Node *in2 ) : SubFPNode(in1,in2) {}
111   virtual int Opcode() const;
112   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
113   virtual const Type *sub( const Type *, const Type * ) const;
114   const Type   *add_id() const { return TypeF::ZERO; }
115   const Type   *bottom_type() const { return Type::FLOAT; }
116   virtual uint  ideal_reg() const { return Op_RegF; }
117 };
118 
119 // NOTE: SubDNode should be taken away and replaced by add and negate
120 //------------------------------SubDNode---------------------------------------
121 // Subtract 2 doubles
122 class SubDNode : public SubFPNode {
123 public:
124   SubDNode( Node *in1, Node *in2 ) : SubFPNode(in1,in2) {}
125   virtual int Opcode() const;
126   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
127   virtual const Type *sub( const Type *, const Type * ) const;
128   const Type   *add_id() const { return TypeD::ZERO; }
129   const Type   *bottom_type() const { return Type::DOUBLE; }
130   virtual uint  ideal_reg() const { return Op_RegD; }
131 };
132 
133 //------------------------------CmpNode---------------------------------------
134 // Compare 2 values, returning condition codes (-1, 0 or 1).
135 class CmpNode : public SubNode {
136 public:
137   CmpNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {
138     init_class_id(Class_Cmp);
139   }
140   virtual Node* Identity(PhaseGVN* phase);
141   const Type *add_id() const { return TypeInt::ZERO; }
142   const Type *bottom_type() const { return TypeInt::CC; }
143   virtual uint ideal_reg() const { return Op_RegFlags; }
144 
145   static CmpNode *make(Node *in1, Node *in2, BasicType bt, bool unsigned_comp = false);
146 };
147 
148 //------------------------------CmpINode---------------------------------------
149 // Compare 2 signed values, returning condition codes (-1, 0 or 1).
150 class CmpINode : public CmpNode {
151 public:
152   CmpINode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
153   virtual int Opcode() const;
154   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
155   virtual const Type *sub( const Type *, const Type * ) const;
156 };
157 
158 //------------------------------CmpUNode---------------------------------------
159 // Compare 2 unsigned values (integer or pointer), returning condition codes (-1, 0 or 1).
160 class CmpUNode : public CmpNode {
161 public:
162   CmpUNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
163   virtual int Opcode() const;
164   virtual const Type *sub( const Type *, const Type * ) const;
165   const Type* Value(PhaseGVN* phase) const;
166   bool is_index_range_check() const;
167 };
168 
169 //------------------------------CmpU3Node--------------------------------------
170 // Compare 2 unsigned values, returning integer value (-1, 0 or 1).
171 class CmpU3Node : public CmpUNode {
172 public:
173   CmpU3Node( Node *in1, Node *in2 ) : CmpUNode(in1,in2) {
174     // Since it is not consumed by Bools, it is not really a Cmp.
175     init_class_id(Class_Sub);
176   }
177   virtual int Opcode() const;
178   virtual uint ideal_reg() const { return Op_RegI; }
179 };
180 
181 //------------------------------CmpPNode---------------------------------------
182 // Compare 2 pointer values, returning condition codes (-1, 0 or 1).
183 class CmpPNode : public CmpNode {
184 public:
185   CmpPNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
186   virtual int Opcode() const;
187   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
188   virtual const Type *sub( const Type *, const Type * ) const;
189 };
190 
191 //------------------------------CmpNNode--------------------------------------
192 // Compare 2 narrow oop values, returning condition codes (-1, 0 or 1).
193 class CmpNNode : public CmpNode {
194 public:
195   CmpNNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
196   virtual int Opcode() const;
197   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
198   virtual const Type *sub( const Type *, const Type * ) const;
199 };
200 
201 //------------------------------CmpLNode---------------------------------------
202 // Compare 2 long values, returning condition codes (-1, 0 or 1).
203 class CmpLNode : public CmpNode {
204 public:
205   CmpLNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
206   virtual int    Opcode() const;
207   virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
208   virtual const Type* Value(PhaseGVN* phase) const;
209   virtual const Type *sub( const Type *, const Type * ) const;
210   bool is_double_null_check(PhaseGVN* phase, Node*& a, Node*& b) const;
211 };
212 
213 //------------------------------CmpULNode---------------------------------------
214 // Compare 2 unsigned long values, returning condition codes (-1, 0 or 1).
215 class CmpULNode : public CmpNode {
216 public:
217   CmpULNode(Node* in1, Node* in2) : CmpNode(in1, in2) { }
218   virtual int Opcode() const;
219   virtual const Type* sub(const Type*, const Type*) const;
220 };
221 
222 //------------------------------CmpL3Node--------------------------------------
223 // Compare 2 long values, returning integer value (-1, 0 or 1).
224 class CmpL3Node : public CmpLNode {
225 public:
226   CmpL3Node( Node *in1, Node *in2 ) : CmpLNode(in1,in2) {
227     // Since it is not consumed by Bools, it is not really a Cmp.
228     init_class_id(Class_Sub);
229   }
230   virtual int Opcode() const;
231   virtual uint ideal_reg() const { return Op_RegI; }
232 };
233 
234 //------------------------------CmpUL3Node-------------------------------------
235 // Compare 2 unsigned long values, returning integer value (-1, 0 or 1).
236 class CmpUL3Node : public CmpULNode {
237 public:
238   CmpUL3Node( Node *in1, Node *in2 ) : CmpULNode(in1,in2) {
239     // Since it is not consumed by Bools, it is not really a Cmp.
240     init_class_id(Class_Sub);
241   }
242   virtual int Opcode() const;
243   virtual uint ideal_reg() const { return Op_RegI; }
244 };
245 
246 //------------------------------CmpFNode---------------------------------------
247 // Compare 2 float values, returning condition codes (-1, 0 or 1).
248 // This implements the Java bytecode fcmpl, so unordered returns -1.
249 // Operands may not commute.
250 class CmpFNode : public CmpNode {
251 public:
252   CmpFNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
253   virtual int Opcode() const;
254   virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return NULL; }
255   const Type* Value(PhaseGVN* phase) const;
256 };
257 
258 //------------------------------CmpF3Node--------------------------------------
259 // Compare 2 float values, returning integer value (-1, 0 or 1).
260 // This implements the Java bytecode fcmpl, so unordered returns -1.
261 // Operands may not commute.
262 class CmpF3Node : public CmpFNode {
263 public:
264   CmpF3Node( Node *in1, Node *in2 ) : CmpFNode(in1,in2) {
265     // Since it is not consumed by Bools, it is not really a Cmp.
266     init_class_id(Class_Sub);
267   }
268   virtual int Opcode() const;
269   // Since it is not consumed by Bools, it is not really a Cmp.
270   virtual uint ideal_reg() const { return Op_RegI; }
271 };
272 
273 
274 //------------------------------CmpDNode---------------------------------------
275 // Compare 2 double values, returning condition codes (-1, 0 or 1).
276 // This implements the Java bytecode dcmpl, so unordered returns -1.
277 // Operands may not commute.
278 class CmpDNode : public CmpNode {
279 public:
280   CmpDNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
281   virtual int Opcode() const;
282   virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return NULL; }
283   const Type* Value(PhaseGVN* phase) const;
284   virtual Node  *Ideal(PhaseGVN *phase, bool can_reshape);
285 };
286 
287 //------------------------------CmpD3Node--------------------------------------
288 // Compare 2 double values, returning integer value (-1, 0 or 1).
289 // This implements the Java bytecode dcmpl, so unordered returns -1.
290 // Operands may not commute.
291 class CmpD3Node : public CmpDNode {
292 public:
293   CmpD3Node( Node *in1, Node *in2 ) : CmpDNode(in1,in2) {
294     // Since it is not consumed by Bools, it is not really a Cmp.
295     init_class_id(Class_Sub);
296   }
297   virtual int Opcode() const;
298   virtual uint ideal_reg() const { return Op_RegI; }
299 };
300 
301 //--------------------------FlatArrayCheckNode---------------------------------
302 // Returns true if one of the input array objects or array klass ptrs (there
303 // can be multiple) is flat.
304 class FlatArrayCheckNode : public CmpNode {
305 public:
306   enum {
307     Control,
308     Memory,
309     ArrayOrKlass
310   };
311   FlatArrayCheckNode(Compile* C, Node* mem, Node* array_or_klass) : CmpNode(mem, array_or_klass) {
312     init_class_id(Class_FlatArrayCheck);
313     init_flags(Flag_is_macro);
314     C->add_macro_node(this);
315   }
316   virtual int Opcode() const;
317   virtual const Type* sub(const Type*, const Type*) const { ShouldNotReachHere(); return NULL; }
318   const Type* Value(PhaseGVN* phase) const;
319   virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
320 };
321 
322 //------------------------------BoolTest---------------------------------------
323 // Convert condition codes to a boolean test value (0 or -1).
324 // We pick the values as 3 bits; the low order 2 bits we compare against the
325 // condition codes, the high bit flips the sense of the result.
326 // For vector compares, additionally, the 4th bit indicates if the compare is unsigned
327 struct BoolTest {
328   enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, never = 8, illegal = 9,
329               // The following values are used with vector compares
330               // A BoolTest value should not be constructed for such values
331               unsigned_compare = 16,
332               ule = unsigned_compare | le, uge = unsigned_compare | ge, ult = unsigned_compare | lt, ugt = unsigned_compare | gt };
333   mask _test;
334   BoolTest( mask btm ) : _test(btm) { assert((btm & unsigned_compare) == 0, "unsupported");}
335   const Type *cc2logical( const Type *CC ) const;
336   // Commute the test.  I use a small table lookup.  The table is created as
337   // a simple char array where each element is the ASCII version of a 'mask'
338   // enum from above.
339   mask commute( ) const { return mask("032147658"[_test]-'0'); }
340   mask negate( ) const { return mask(_test^4); }
341   bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le || _test == BoolTest::overflow); }
342   bool is_less( )  const { return _test == BoolTest::lt || _test == BoolTest::le; }
343   bool is_greater( ) const { return _test == BoolTest::gt || _test == BoolTest::ge; }
344   void dump_on(outputStream *st) const;
345   mask merge(BoolTest other) const;
346 };
347 
348 //------------------------------BoolNode---------------------------------------
349 // A Node to convert a Condition Codes to a Logical result.
350 class BoolNode : public Node {
351   virtual uint hash() const;
352   virtual bool cmp( const Node &n ) const;
353   virtual uint size_of() const;
354 
355   // Try to optimize signed integer comparison
356   Node* fold_cmpI(PhaseGVN* phase, SubNode* cmp, Node* cmp1, int cmp_op,
357                   int cmp1_op, const TypeInt* cmp2_type);
358 public:
359   const BoolTest _test;
360   BoolNode(Node *cc, BoolTest::mask t): Node(NULL,cc), _test(t) {
361     init_class_id(Class_Bool);
362   }
363   // Convert an arbitrary int value to a Bool or other suitable predicate.
364   static Node* make_predicate(Node* test_value, PhaseGVN* phase);
365   // Convert self back to an integer value.
366   Node* as_int_value(PhaseGVN* phase);
367   // Invert sense of self, returning new Bool.
368   BoolNode* negate(PhaseGVN* phase);
369   virtual int Opcode() const;
370   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
371   virtual const Type* Value(PhaseGVN* phase) const;
372   virtual const Type *bottom_type() const { return TypeInt::BOOL; }
373   uint match_edge(uint idx) const { return 0; }
374   virtual uint ideal_reg() const { return Op_RegI; }
375 
376   bool is_counted_loop_exit_test();
377 #ifndef PRODUCT
378   virtual void dump_spec(outputStream *st) const;
379 #endif
380 };
381 
382 //------------------------------AbsNode----------------------------------------
383 // Abstract class for absolute value.  Mostly used to get a handy wrapper
384 // for finding this pattern in the graph.
385 class AbsNode : public Node {
386 public:
387   AbsNode( Node *value ) : Node(0,value) {}
388   virtual Node* Identity(PhaseGVN* phase);
389   virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
390   virtual const Type* Value(PhaseGVN* phase) const;
391 };
392 
393 //------------------------------AbsINode---------------------------------------
394 // Absolute value an integer.  Since a naive graph involves control flow, we
395 // "match" it in the ideal world (so the control flow can be removed).
396 class AbsINode : public AbsNode {
397 public:
398   AbsINode( Node *in1 ) : AbsNode(in1) {}
399   virtual int Opcode() const;
400   const Type *bottom_type() const { return TypeInt::INT; }
401   virtual uint ideal_reg() const { return Op_RegI; }
402 };
403 
404 //------------------------------AbsLNode---------------------------------------
405 // Absolute value a long.  Since a naive graph involves control flow, we
406 // "match" it in the ideal world (so the control flow can be removed).
407 class AbsLNode : public AbsNode {
408 public:
409   AbsLNode( Node *in1 ) : AbsNode(in1) {}
410   virtual int Opcode() const;
411   const Type *bottom_type() const { return TypeLong::LONG; }
412   virtual uint ideal_reg() const { return Op_RegL; }
413 };
414 
415 //------------------------------AbsFNode---------------------------------------
416 // Absolute value a float, a common float-point idiom with a cheap hardware
417 // implementation on most chips.  Since a naive graph involves control flow, we
418 // "match" it in the ideal world (so the control flow can be removed).
419 class AbsFNode : public AbsNode {
420 public:
421   AbsFNode( Node *in1 ) : AbsNode(in1) {}
422   virtual int Opcode() const;
423   const Type *bottom_type() const { return Type::FLOAT; }
424   virtual uint ideal_reg() const { return Op_RegF; }
425 };
426 
427 //------------------------------AbsDNode---------------------------------------
428 // Absolute value a double, a common float-point idiom with a cheap hardware
429 // implementation on most chips.  Since a naive graph involves control flow, we
430 // "match" it in the ideal world (so the control flow can be removed).
431 class AbsDNode : public AbsNode {
432 public:
433   AbsDNode( Node *in1 ) : AbsNode(in1) {}
434   virtual int Opcode() const;
435   const Type *bottom_type() const { return Type::DOUBLE; }
436   virtual uint ideal_reg() const { return Op_RegD; }
437 };
438 
439 
440 //------------------------------CmpLTMaskNode----------------------------------
441 // If p < q, return -1 else return 0.  Nice for flow-free idioms.
442 class CmpLTMaskNode : public Node {
443 public:
444   CmpLTMaskNode( Node *p, Node *q ) : Node(0, p, q) {}
445   virtual int Opcode() const;
446   const Type *bottom_type() const { return TypeInt::INT; }
447   virtual uint ideal_reg() const { return Op_RegI; }
448 };
449 
450 
451 //------------------------------NegNode----------------------------------------
452 class NegNode : public Node {
453 public:
454   NegNode( Node *in1 ) : Node(0,in1) {}
455 };
456 
457 //------------------------------NegINode---------------------------------------
458 // Negate value an int.  For int values, negation is the same as subtraction
459 // from zero
460 class NegINode : public NegNode {
461 public:
462   NegINode(Node *in1) : NegNode(in1) {}
463   virtual int Opcode() const;
464   const Type *bottom_type() const { return TypeInt::INT; }
465   virtual uint ideal_reg() const { return Op_RegI; }
466 };
467 
468 //------------------------------NegLNode---------------------------------------
469 // Negate value an int.  For int values, negation is the same as subtraction
470 // from zero
471 class NegLNode : public NegNode {
472 public:
473   NegLNode(Node *in1) : NegNode(in1) {}
474   virtual int Opcode() const;
475   const Type *bottom_type() const { return TypeLong::LONG; }
476   virtual uint ideal_reg() const { return Op_RegL; }
477 };
478 
479 //------------------------------NegFNode---------------------------------------
480 // Negate value a float.  Negating 0.0 returns -0.0, but subtracting from
481 // zero returns +0.0 (per JVM spec on 'fneg' bytecode).  As subtraction
482 // cannot be used to replace negation we have to implement negation as ideal
483 // node; note that negation and addition can replace subtraction.
484 class NegFNode : public NegNode {
485 public:
486   NegFNode( Node *in1 ) : NegNode(in1) {}
487   virtual int Opcode() const;
488   const Type *bottom_type() const { return Type::FLOAT; }
489   virtual uint ideal_reg() const { return Op_RegF; }
490 };
491 
492 //------------------------------NegDNode---------------------------------------
493 // Negate value a double.  Negating 0.0 returns -0.0, but subtracting from
494 // zero returns +0.0 (per JVM spec on 'dneg' bytecode).  As subtraction
495 // cannot be used to replace negation we have to implement negation as ideal
496 // node; note that negation and addition can replace subtraction.
497 class NegDNode : public NegNode {
498 public:
499   NegDNode( Node *in1 ) : NegNode(in1) {}
500   virtual int Opcode() const;
501   const Type *bottom_type() const { return Type::DOUBLE; }
502   virtual uint ideal_reg() const { return Op_RegD; }
503 };
504 
505 //------------------------------AtanDNode--------------------------------------
506 // arcus tangens of a double
507 class AtanDNode : public Node {
508 public:
509   AtanDNode(Node *c, Node *in1, Node *in2  ) : Node(c, in1, in2) {}
510   virtual int Opcode() const;
511   const Type *bottom_type() const { return Type::DOUBLE; }
512   virtual uint ideal_reg() const { return Op_RegD; }
513 };
514 
515 
516 //------------------------------SqrtDNode--------------------------------------
517 // square root a double
518 class SqrtDNode : public Node {
519 public:
520   SqrtDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
521     init_flags(Flag_is_expensive);
522     C->add_expensive_node(this);
523   }
524   virtual int Opcode() const;
525   const Type *bottom_type() const { return Type::DOUBLE; }
526   virtual uint ideal_reg() const { return Op_RegD; }
527   virtual const Type* Value(PhaseGVN* phase) const;
528 };
529 
530 //------------------------------SqrtFNode--------------------------------------
531 // square root a float
532 class SqrtFNode : public Node {
533 public:
534   SqrtFNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
535     init_flags(Flag_is_expensive);
536     if (c != NULL) {
537       // Treat node only as expensive if a control input is set because it might
538       // be created from a SqrtDNode in ConvD2FNode::Ideal() that was found to
539       // be unique and therefore has no control input.
540       C->add_expensive_node(this);
541     }
542   }
543   virtual int Opcode() const;
544   const Type *bottom_type() const { return Type::FLOAT; }
545   virtual uint ideal_reg() const { return Op_RegF; }
546   virtual const Type* Value(PhaseGVN* phase) const;
547 };
548 
549 //-------------------------------ReverseBytesINode--------------------------------
550 // reverse bytes of an integer
551 class ReverseBytesINode : public Node {
552 public:
553   ReverseBytesINode(Node *c, Node *in1) : Node(c, in1) {}
554   virtual int Opcode() const;
555   const Type *bottom_type() const { return TypeInt::INT; }
556   virtual uint ideal_reg() const { return Op_RegI; }
557 };
558 
559 //-------------------------------ReverseBytesLNode--------------------------------
560 // reverse bytes of a long
561 class ReverseBytesLNode : public Node {
562 public:
563   ReverseBytesLNode(Node *c, Node *in1) : Node(c, in1) {}
564   virtual int Opcode() const;
565   const Type *bottom_type() const { return TypeLong::LONG; }
566   virtual uint ideal_reg() const { return Op_RegL; }
567 };
568 
569 //-------------------------------ReverseBytesUSNode--------------------------------
570 // reverse bytes of an unsigned short / char
571 class ReverseBytesUSNode : public Node {
572 public:
573   ReverseBytesUSNode(Node *c, Node *in1) : Node(c, in1) {}
574   virtual int Opcode() const;
575   const Type *bottom_type() const { return TypeInt::CHAR; }
576   virtual uint ideal_reg() const { return Op_RegI; }
577 };
578 
579 //-------------------------------ReverseBytesSNode--------------------------------
580 // reverse bytes of a short
581 class ReverseBytesSNode : public Node {
582 public:
583   ReverseBytesSNode(Node *c, Node *in1) : Node(c, in1) {}
584   virtual int Opcode() const;
585   const Type *bottom_type() const { return TypeInt::SHORT; }
586   virtual uint ideal_reg() const { return Op_RegI; }
587 };
588 
589 //-------------------------------ReverseINode--------------------------------
590 // reverse bits of an int
591 class ReverseINode : public Node {
592 public:
593   ReverseINode(Node *c, Node *in1) : Node(c, in1) {}
594   virtual int Opcode() const;
595   const Type *bottom_type() const { return TypeInt::INT; }
596   virtual uint ideal_reg() const { return Op_RegI; }
597   virtual Node* Identity(PhaseGVN* phase);
598   virtual const Type* Value(PhaseGVN* phase) const;
599 };
600 
601 //-------------------------------ReverseLNode--------------------------------
602 // reverse bits of a long
603 class ReverseLNode : public Node {
604 public:
605   ReverseLNode(Node *c, Node *in1) : Node(c, in1) {}
606   virtual int Opcode() const;
607   const Type *bottom_type() const { return TypeLong::LONG; }
608   virtual uint ideal_reg() const { return Op_RegL; }
609   virtual Node* Identity(PhaseGVN* phase);
610   virtual const Type* Value(PhaseGVN* phase) const;
611 };
612 
613 #endif // SHARE_OPTO_SUBNODE_HPP