1 /*
  2  * Copyright (c) 1997, 2024, 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(nullptr,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(PhaseValues* 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   virtual const Type* Value(PhaseGVN* phase) const;
157 };
158 
159 //------------------------------CmpUNode---------------------------------------
160 // Compare 2 unsigned values (integer or pointer), returning condition codes (-1, 0 or 1).
161 class CmpUNode : public CmpNode {
162 public:
163   CmpUNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
164   virtual int Opcode() const;
165   virtual const Type *sub( const Type *, const Type * ) const;
166   const Type* Value(PhaseGVN* phase) const;
167   bool is_index_range_check() const;
168 };
169 
170 //------------------------------CmpU3Node--------------------------------------
171 // Compare 2 unsigned values, returning integer value (-1, 0 or 1).
172 class CmpU3Node : public CmpUNode {
173 public:
174   CmpU3Node( Node *in1, Node *in2 ) : CmpUNode(in1,in2) {
175     // Since it is not consumed by Bools, it is not really a Cmp.
176     init_class_id(Class_Sub);
177   }
178   virtual int Opcode() const;
179   virtual uint ideal_reg() const { return Op_RegI; }
180 };
181 
182 //------------------------------CmpPNode---------------------------------------
183 // Compare 2 pointer values, returning condition codes (-1, 0 or 1).
184 class CmpPNode : public CmpNode {
185 public:
186   CmpPNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
187   virtual int Opcode() const;
188   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
189   virtual const Type *sub( const Type *, const Type * ) const;
190 };
191 
192 //------------------------------CmpNNode--------------------------------------
193 // Compare 2 narrow oop values, returning condition codes (-1, 0 or 1).
194 class CmpNNode : public CmpNode {
195 public:
196   CmpNNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
197   virtual int Opcode() const;
198   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
199   virtual const Type *sub( const Type *, const Type * ) const;
200 };
201 
202 //------------------------------CmpLNode---------------------------------------
203 // Compare 2 long values, returning condition codes (-1, 0 or 1).
204 class CmpLNode : public CmpNode {
205 public:
206   CmpLNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
207   virtual int    Opcode() const;
208   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
209   virtual const Type *sub( const Type *, const Type * ) const;
210 };
211 
212 //------------------------------CmpULNode---------------------------------------
213 // Compare 2 unsigned long values, returning condition codes (-1, 0 or 1).
214 class CmpULNode : public CmpNode {
215 public:
216   CmpULNode(Node* in1, Node* in2) : CmpNode(in1, in2) { }
217   virtual int Opcode() const;
218   virtual const Type* sub(const Type*, const Type*) const;
219 };
220 
221 //------------------------------CmpL3Node--------------------------------------
222 // Compare 2 long values, returning integer value (-1, 0 or 1).
223 class CmpL3Node : public CmpLNode {
224 public:
225   CmpL3Node( Node *in1, Node *in2 ) : CmpLNode(in1,in2) {
226     // Since it is not consumed by Bools, it is not really a Cmp.
227     init_class_id(Class_Sub);
228   }
229   virtual int Opcode() const;
230   virtual uint ideal_reg() const { return Op_RegI; }
231 };
232 
233 //------------------------------CmpUL3Node-------------------------------------
234 // Compare 2 unsigned long values, returning integer value (-1, 0 or 1).
235 class CmpUL3Node : public CmpULNode {
236 public:
237   CmpUL3Node( Node *in1, Node *in2 ) : CmpULNode(in1,in2) {
238     // Since it is not consumed by Bools, it is not really a Cmp.
239     init_class_id(Class_Sub);
240   }
241   virtual int Opcode() const;
242   virtual uint ideal_reg() const { return Op_RegI; }
243 };
244 
245 //------------------------------CmpFNode---------------------------------------
246 // Compare 2 float values, returning condition codes (-1, 0 or 1).
247 // This implements the Java bytecode fcmpl, so unordered returns -1.
248 // Operands may not commute.
249 class CmpFNode : public CmpNode {
250 public:
251   CmpFNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
252   virtual int Opcode() const;
253   virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return nullptr; }
254   const Type* Value(PhaseGVN* phase) const;
255 };
256 
257 //------------------------------CmpF3Node--------------------------------------
258 // Compare 2 float values, returning integer value (-1, 0 or 1).
259 // This implements the Java bytecode fcmpl, so unordered returns -1.
260 // Operands may not commute.
261 class CmpF3Node : public CmpFNode {
262 public:
263   CmpF3Node( Node *in1, Node *in2 ) : CmpFNode(in1,in2) {
264     // Since it is not consumed by Bools, it is not really a Cmp.
265     init_class_id(Class_Sub);
266   }
267   virtual int Opcode() const;
268   // Since it is not consumed by Bools, it is not really a Cmp.
269   virtual uint ideal_reg() const { return Op_RegI; }
270 };
271 
272 
273 //------------------------------CmpDNode---------------------------------------
274 // Compare 2 double values, returning condition codes (-1, 0 or 1).
275 // This implements the Java bytecode dcmpl, so unordered returns -1.
276 // Operands may not commute.
277 class CmpDNode : public CmpNode {
278 public:
279   CmpDNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
280   virtual int Opcode() const;
281   virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return nullptr; }
282   const Type* Value(PhaseGVN* phase) const;
283   virtual Node  *Ideal(PhaseGVN *phase, bool can_reshape);
284 };
285 
286 //------------------------------CmpD3Node--------------------------------------
287 // Compare 2 double values, returning integer value (-1, 0 or 1).
288 // This implements the Java bytecode dcmpl, so unordered returns -1.
289 // Operands may not commute.
290 class CmpD3Node : public CmpDNode {
291 public:
292   CmpD3Node( Node *in1, Node *in2 ) : CmpDNode(in1,in2) {
293     // Since it is not consumed by Bools, it is not really a Cmp.
294     init_class_id(Class_Sub);
295   }
296   virtual int Opcode() const;
297   virtual uint ideal_reg() const { return Op_RegI; }
298 };
299 
300 
301 //------------------------------BoolTest---------------------------------------
302 // Convert condition codes to a boolean test value (0 or -1).
303 // We pick the values as 3 bits; the low order 2 bits we compare against the
304 // condition codes, the high bit flips the sense of the result.
305 // For vector compares, additionally, the 4th bit indicates if the compare is unsigned
306 struct BoolTest {
307   enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, never = 8, illegal = 9,
308               // The following values are used with vector compares
309               // A BoolTest value should not be constructed for such values
310               unsigned_compare = 16,
311               ule = unsigned_compare | le, uge = unsigned_compare | ge, ult = unsigned_compare | lt, ugt = unsigned_compare | gt };
312   mask _test;
313   BoolTest( mask btm ) : _test(btm) { assert((btm & unsigned_compare) == 0, "unsupported");}
314   const Type *cc2logical( const Type *CC ) const;
315   // Commute the test.  I use a small table lookup.  The table is created as
316   // a simple char array where each element is the ASCII version of a 'mask'
317   // enum from above.
318   mask commute( ) const { return mask("032147658"[_test]-'0'); }
319   mask negate( ) const { return mask(_test^4); }
320   bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le || _test == BoolTest::overflow); }
321   bool is_less( )  const { return _test == BoolTest::lt || _test == BoolTest::le; }
322   bool is_greater( ) const { return _test == BoolTest::gt || _test == BoolTest::ge; }
323   void dump_on(outputStream *st) const;
324   mask merge(BoolTest other) const;
325 };
326 
327 //------------------------------BoolNode---------------------------------------
328 // A Node to convert a Condition Codes to a Logical result.
329 class BoolNode : public Node {
330   virtual uint hash() const;
331   virtual bool cmp( const Node &n ) const;
332   virtual uint size_of() const;
333 
334   // Try to optimize signed integer comparison
335   Node* fold_cmpI(PhaseGVN* phase, SubNode* cmp, Node* cmp1, int cmp_op,
336                   int cmp1_op, const TypeInt* cmp2_type);
337 public:
338   const BoolTest _test;
339   BoolNode(Node *cc, BoolTest::mask t): Node(nullptr,cc), _test(t) {
340     init_class_id(Class_Bool);
341   }
342   // Convert an arbitrary int value to a Bool or other suitable predicate.
343   static Node* make_predicate(Node* test_value, PhaseGVN* phase);
344   // Convert self back to an integer value.
345   Node* as_int_value(PhaseGVN* phase);
346   // Invert sense of self, returning new Bool.
347   BoolNode* negate(PhaseGVN* phase);
348   virtual int Opcode() const;
349   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
350   const Type* Value_cmpu_and_mask(PhaseValues* phase) const;
351   virtual const Type* Value(PhaseGVN* phase) const;
352   virtual const Type *bottom_type() const { return TypeInt::BOOL; }
353   uint match_edge(uint idx) const { return 0; }
354   virtual uint ideal_reg() const { return Op_RegI; }
355 
356   bool is_counted_loop_exit_test();
357 #ifndef PRODUCT
358   virtual void dump_spec(outputStream *st) const;
359 #endif
360 };
361 
362 //------------------------------AbsNode----------------------------------------
363 // Abstract class for absolute value.  Mostly used to get a handy wrapper
364 // for finding this pattern in the graph.
365 class AbsNode : public Node {
366 public:
367   AbsNode( Node *value ) : Node(nullptr,value) {}
368   virtual Node* Identity(PhaseGVN* phase);
369   virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
370   virtual const Type* Value(PhaseGVN* phase) const;
371 };
372 
373 //------------------------------AbsINode---------------------------------------
374 // Absolute value an integer.  Since a naive graph involves control flow, we
375 // "match" it in the ideal world (so the control flow can be removed).
376 class AbsINode : public AbsNode {
377 public:
378   AbsINode( Node *in1 ) : AbsNode(in1) {}
379   virtual int Opcode() const;
380   const Type *bottom_type() const { return TypeInt::INT; }
381   virtual uint ideal_reg() const { return Op_RegI; }
382 };
383 
384 //------------------------------AbsLNode---------------------------------------
385 // Absolute value a long.  Since a naive graph involves control flow, we
386 // "match" it in the ideal world (so the control flow can be removed).
387 class AbsLNode : public AbsNode {
388 public:
389   AbsLNode( Node *in1 ) : AbsNode(in1) {}
390   virtual int Opcode() const;
391   const Type *bottom_type() const { return TypeLong::LONG; }
392   virtual uint ideal_reg() const { return Op_RegL; }
393 };
394 
395 //------------------------------AbsFNode---------------------------------------
396 // Absolute value a float, a common float-point idiom with a cheap hardware
397 // implementation on most chips.  Since a naive graph involves control flow, we
398 // "match" it in the ideal world (so the control flow can be removed).
399 class AbsFNode : public AbsNode {
400 public:
401   AbsFNode( Node *in1 ) : AbsNode(in1) {}
402   virtual int Opcode() const;
403   const Type *bottom_type() const { return Type::FLOAT; }
404   virtual uint ideal_reg() const { return Op_RegF; }
405 };
406 
407 //------------------------------AbsDNode---------------------------------------
408 // Absolute value a double, a common float-point idiom with a cheap hardware
409 // implementation on most chips.  Since a naive graph involves control flow, we
410 // "match" it in the ideal world (so the control flow can be removed).
411 class AbsDNode : public AbsNode {
412 public:
413   AbsDNode( Node *in1 ) : AbsNode(in1) {}
414   virtual int Opcode() const;
415   const Type *bottom_type() const { return Type::DOUBLE; }
416   virtual uint ideal_reg() const { return Op_RegD; }
417 };
418 
419 
420 //------------------------------CmpLTMaskNode----------------------------------
421 // If p < q, return -1 else return 0.  Nice for flow-free idioms.
422 class CmpLTMaskNode : public Node {
423 public:
424   CmpLTMaskNode( Node *p, Node *q ) : Node(nullptr, p, q) {}
425   virtual int Opcode() const;
426   const Type *bottom_type() const { return TypeInt::INT; }
427   virtual uint ideal_reg() const { return Op_RegI; }
428 };
429 
430 
431 //------------------------------NegNode----------------------------------------
432 class NegNode : public Node {
433 public:
434   NegNode(Node* in1) : Node(nullptr, in1) {
435     init_class_id(Class_Neg);
436   }
437 };
438 
439 //------------------------------NegINode---------------------------------------
440 // Negate value an int.  For int values, negation is the same as subtraction
441 // from zero
442 class NegINode : public NegNode {
443 public:
444   NegINode(Node *in1) : NegNode(in1) {}
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 //------------------------------NegLNode---------------------------------------
451 // Negate value an int.  For int values, negation is the same as subtraction
452 // from zero
453 class NegLNode : public NegNode {
454 public:
455   NegLNode(Node *in1) : NegNode(in1) {}
456   virtual int Opcode() const;
457   const Type *bottom_type() const { return TypeLong::LONG; }
458   virtual uint ideal_reg() const { return Op_RegL; }
459 };
460 
461 //------------------------------NegFNode---------------------------------------
462 // Negate value a float.  Negating 0.0 returns -0.0, but subtracting from
463 // zero returns +0.0 (per JVM spec on 'fneg' bytecode).  As subtraction
464 // cannot be used to replace negation we have to implement negation as ideal
465 // node; note that negation and addition can replace subtraction.
466 class NegFNode : public NegNode {
467 public:
468   NegFNode( Node *in1 ) : NegNode(in1) {}
469   virtual int Opcode() const;
470   const Type *bottom_type() const { return Type::FLOAT; }
471   virtual uint ideal_reg() const { return Op_RegF; }
472 };
473 
474 //------------------------------NegDNode---------------------------------------
475 // Negate value a double.  Negating 0.0 returns -0.0, but subtracting from
476 // zero returns +0.0 (per JVM spec on 'dneg' bytecode).  As subtraction
477 // cannot be used to replace negation we have to implement negation as ideal
478 // node; note that negation and addition can replace subtraction.
479 class NegDNode : public NegNode {
480 public:
481   NegDNode( Node *in1 ) : NegNode(in1) {}
482   virtual int Opcode() const;
483   const Type *bottom_type() const { return Type::DOUBLE; }
484   virtual uint ideal_reg() const { return Op_RegD; }
485 };
486 
487 //------------------------------AtanDNode--------------------------------------
488 // arcus tangens of a double
489 class AtanDNode : public Node {
490 public:
491   AtanDNode(Node *c, Node *in1, Node *in2  ) : Node(c, in1, in2) {}
492   virtual int Opcode() const;
493   const Type *bottom_type() const { return Type::DOUBLE; }
494   virtual uint ideal_reg() const { return Op_RegD; }
495 };
496 
497 
498 //------------------------------SqrtDNode--------------------------------------
499 // square root a double
500 class SqrtDNode : public Node {
501 public:
502   SqrtDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
503     init_flags(Flag_is_expensive);
504     C->add_expensive_node(this);
505   }
506   virtual int Opcode() const;
507   const Type *bottom_type() const { return Type::DOUBLE; }
508   virtual uint ideal_reg() const { return Op_RegD; }
509   virtual const Type* Value(PhaseGVN* phase) const;
510 };
511 
512 //------------------------------SqrtFNode--------------------------------------
513 // square root a float
514 class SqrtFNode : public Node {
515 public:
516   SqrtFNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
517     init_flags(Flag_is_expensive);
518     if (c != nullptr) {
519       // Treat node only as expensive if a control input is set because it might
520       // be created from a SqrtDNode in ConvD2FNode::Ideal() that was found to
521       // be unique and therefore has no control input.
522       C->add_expensive_node(this);
523     }
524   }
525   virtual int Opcode() const;
526   const Type *bottom_type() const { return Type::FLOAT; }
527   virtual uint ideal_reg() const { return Op_RegF; }
528   virtual const Type* Value(PhaseGVN* phase) const;
529 };
530 
531 //-------------------------------ReverseBytesINode--------------------------------
532 // reverse bytes of an integer
533 class ReverseBytesINode : public Node {
534 public:
535   ReverseBytesINode(Node *c, Node *in1) : Node(c, in1) {}
536   virtual int Opcode() const;
537   const Type *bottom_type() const { return TypeInt::INT; }
538   virtual uint ideal_reg() const { return Op_RegI; }
539 };
540 
541 //-------------------------------ReverseBytesLNode--------------------------------
542 // reverse bytes of a long
543 class ReverseBytesLNode : public Node {
544 public:
545   ReverseBytesLNode(Node *c, Node *in1) : Node(c, in1) {}
546   virtual int Opcode() const;
547   const Type *bottom_type() const { return TypeLong::LONG; }
548   virtual uint ideal_reg() const { return Op_RegL; }
549 };
550 
551 //-------------------------------ReverseBytesUSNode--------------------------------
552 // reverse bytes of an unsigned short / char
553 class ReverseBytesUSNode : public Node {
554 public:
555   ReverseBytesUSNode(Node *c, Node *in1) : Node(c, in1) {}
556   virtual int Opcode() const;
557   const Type *bottom_type() const { return TypeInt::CHAR; }
558   virtual uint ideal_reg() const { return Op_RegI; }
559 };
560 
561 //-------------------------------ReverseBytesSNode--------------------------------
562 // reverse bytes of a short
563 class ReverseBytesSNode : public Node {
564 public:
565   ReverseBytesSNode(Node *c, Node *in1) : Node(c, in1) {}
566   virtual int Opcode() const;
567   const Type *bottom_type() const { return TypeInt::SHORT; }
568   virtual uint ideal_reg() const { return Op_RegI; }
569 };
570 
571 //-------------------------------ReverseINode--------------------------------
572 // reverse bits of an int
573 class ReverseINode : public Node {
574 public:
575   ReverseINode(Node *c, Node *in1) : Node(c, in1) {}
576   virtual int Opcode() const;
577   const Type *bottom_type() const { return TypeInt::INT; }
578   virtual uint ideal_reg() const { return Op_RegI; }
579   virtual Node* Identity(PhaseGVN* phase);
580   virtual const Type* Value(PhaseGVN* phase) const;
581 };
582 
583 //-------------------------------ReverseLNode--------------------------------
584 // reverse bits of a long
585 class ReverseLNode : public Node {
586 public:
587   ReverseLNode(Node *c, Node *in1) : Node(c, in1) {}
588   virtual int Opcode() const;
589   const Type *bottom_type() const { return TypeLong::LONG; }
590   virtual uint ideal_reg() const { return Op_RegL; }
591   virtual Node* Identity(PhaseGVN* phase);
592   virtual const Type* Value(PhaseGVN* phase) const;
593 };
594 
595 #endif // SHARE_OPTO_SUBNODE_HPP