< prev index next >

src/hotspot/share/opto/subnode.hpp

Print this page

194   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
195   virtual const Type *sub( const Type *, const Type * ) const;
196 };
197 
198 //------------------------------CmpNNode--------------------------------------
199 // Compare 2 narrow oop values, returning condition codes (-1, 0 or 1).
200 class CmpNNode : public CmpNode {
201 public:
202   CmpNNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
203   virtual int Opcode() const;
204   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
205   virtual const Type *sub( const Type *, const Type * ) const;
206 };
207 
208 //------------------------------CmpLNode---------------------------------------
209 // Compare 2 long values, returning condition codes (-1, 0 or 1).
210 class CmpLNode : public CmpNode {
211 public:
212   CmpLNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
213   virtual int    Opcode() const;
214   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);

215   virtual const Type *sub( const Type *, const Type * ) const;

216   virtual bool operates_on(BasicType bt, bool signed_int) const {
217     assert(bt == T_INT || bt == T_LONG, "unsupported");
218     return bt == T_LONG && signed_int;
219   }
220 };
221 
222 //------------------------------CmpULNode---------------------------------------
223 // Compare 2 unsigned long values, returning condition codes (-1, 0 or 1).
224 class CmpULNode : public CmpNode {
225 public:
226   CmpULNode(Node* in1, Node* in2) : CmpNode(in1, in2) { }
227   virtual int Opcode() const;
228   virtual const Type* sub(const Type*, const Type*) const;
229   virtual bool operates_on(BasicType bt, bool signed_int) const {
230     assert(bt == T_INT || bt == T_LONG, "unsupported");
231     return bt == T_LONG && !signed_int;
232   }
233 };
234 
235 //------------------------------CmpL3Node--------------------------------------

282   virtual int Opcode() const;
283   virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return NULL; }
284   const Type* Value(PhaseGVN* phase) const;
285   virtual Node  *Ideal(PhaseGVN *phase, bool can_reshape);
286 };
287 
288 //------------------------------CmpD3Node--------------------------------------
289 // Compare 2 double values, returning integer value (-1, 0 or 1).
290 // This implements the Java bytecode dcmpl, so unordered returns -1.
291 // Operands may not commute.
292 class CmpD3Node : public CmpDNode {
293 public:
294   CmpD3Node( Node *in1, Node *in2 ) : CmpDNode(in1,in2) {
295     // Since it is not consumed by Bools, it is not really a Cmp.
296     init_class_id(Class_Sub);
297   }
298   virtual int Opcode() const;
299   virtual uint ideal_reg() const { return Op_RegI; }
300 };
301 



















302 
303 //------------------------------BoolTest---------------------------------------
304 // Convert condition codes to a boolean test value (0 or -1).
305 // We pick the values as 3 bits; the low order 2 bits we compare against the
306 // condition codes, the high bit flips the sense of the result.
307 // For vector compares, additionally, the 4th bit indicates if the compare is unsigned
308 struct BoolTest {
309   enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, never = 8, illegal = 9,
310               // The following values are used with vector compares
311               // A BoolTest value should not be constructed for such values
312               unsigned_compare = 16,
313               ule = unsigned_compare | le, uge = unsigned_compare | ge, ult = unsigned_compare | lt, ugt = unsigned_compare | gt };
314   mask _test;
315   BoolTest( mask btm ) : _test(btm) { assert((btm & unsigned_compare) == 0, "unsupported");}
316   const Type *cc2logical( const Type *CC ) const;
317   // Commute the test.  I use a small table lookup.  The table is created as
318   // a simple char array where each element is the ASCII version of a 'mask'
319   // enum from above.
320   mask commute( ) const { return mask("032147658"[_test]-'0'); }
321   mask negate( ) const { return mask(_test^4); }

194   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
195   virtual const Type *sub( const Type *, const Type * ) const;
196 };
197 
198 //------------------------------CmpNNode--------------------------------------
199 // Compare 2 narrow oop values, returning condition codes (-1, 0 or 1).
200 class CmpNNode : public CmpNode {
201 public:
202   CmpNNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
203   virtual int Opcode() const;
204   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
205   virtual const Type *sub( const Type *, const Type * ) const;
206 };
207 
208 //------------------------------CmpLNode---------------------------------------
209 // Compare 2 long values, returning condition codes (-1, 0 or 1).
210 class CmpLNode : public CmpNode {
211 public:
212   CmpLNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
213   virtual int    Opcode() const;
214   virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
215   virtual const Type* Value(PhaseGVN* phase) const;
216   virtual const Type *sub( const Type *, const Type * ) const;
217   bool is_double_null_check(PhaseGVN* phase, Node*& a, Node*& b) const;
218   virtual bool operates_on(BasicType bt, bool signed_int) const {
219     assert(bt == T_INT || bt == T_LONG, "unsupported");
220     return bt == T_LONG && signed_int;
221   }
222 };
223 
224 //------------------------------CmpULNode---------------------------------------
225 // Compare 2 unsigned long values, returning condition codes (-1, 0 or 1).
226 class CmpULNode : public CmpNode {
227 public:
228   CmpULNode(Node* in1, Node* in2) : CmpNode(in1, in2) { }
229   virtual int Opcode() const;
230   virtual const Type* sub(const Type*, const Type*) const;
231   virtual bool operates_on(BasicType bt, bool signed_int) const {
232     assert(bt == T_INT || bt == T_LONG, "unsupported");
233     return bt == T_LONG && !signed_int;
234   }
235 };
236 
237 //------------------------------CmpL3Node--------------------------------------

284   virtual int Opcode() const;
285   virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return NULL; }
286   const Type* Value(PhaseGVN* phase) const;
287   virtual Node  *Ideal(PhaseGVN *phase, bool can_reshape);
288 };
289 
290 //------------------------------CmpD3Node--------------------------------------
291 // Compare 2 double values, returning integer value (-1, 0 or 1).
292 // This implements the Java bytecode dcmpl, so unordered returns -1.
293 // Operands may not commute.
294 class CmpD3Node : public CmpDNode {
295 public:
296   CmpD3Node( Node *in1, Node *in2 ) : CmpDNode(in1,in2) {
297     // Since it is not consumed by Bools, it is not really a Cmp.
298     init_class_id(Class_Sub);
299   }
300   virtual int Opcode() const;
301   virtual uint ideal_reg() const { return Op_RegI; }
302 };
303 
304 //--------------------------FlatArrayCheckNode---------------------------------
305 // Returns true if one of the input arrays (there can be multiple) is flat.
306 class FlatArrayCheckNode : public CmpNode {
307 public:
308   enum {
309     Control,
310     Memory,
311     Array
312   };
313   FlatArrayCheckNode(Compile* C, Node* mem, Node* array) : CmpNode(mem, array) {
314     init_class_id(Class_FlatArrayCheck);
315     init_flags(Flag_is_macro);
316     C->add_macro_node(this);
317   }
318   virtual int Opcode() const;
319   virtual const Type* sub(const Type*, const Type*) const { ShouldNotReachHere(); return NULL; }
320   const Type* Value(PhaseGVN* phase) const;
321   virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
322 };
323 
324 //------------------------------BoolTest---------------------------------------
325 // Convert condition codes to a boolean test value (0 or -1).
326 // We pick the values as 3 bits; the low order 2 bits we compare against the
327 // condition codes, the high bit flips the sense of the result.
328 // For vector compares, additionally, the 4th bit indicates if the compare is unsigned
329 struct BoolTest {
330   enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, never = 8, illegal = 9,
331               // The following values are used with vector compares
332               // A BoolTest value should not be constructed for such values
333               unsigned_compare = 16,
334               ule = unsigned_compare | le, uge = unsigned_compare | ge, ult = unsigned_compare | lt, ugt = unsigned_compare | gt };
335   mask _test;
336   BoolTest( mask btm ) : _test(btm) { assert((btm & unsigned_compare) == 0, "unsupported");}
337   const Type *cc2logical( const Type *CC ) const;
338   // Commute the test.  I use a small table lookup.  The table is created as
339   // a simple char array where each element is the ASCII version of a 'mask'
340   // enum from above.
341   mask commute( ) const { return mask("032147658"[_test]-'0'); }
342   mask negate( ) const { return mask(_test^4); }
< prev index next >