< prev index next >

src/hotspot/share/opto/subnode.hpp

Print this page

182   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
183   virtual const Type *sub( const Type *, const Type * ) const;
184 };
185 
186 //------------------------------CmpNNode--------------------------------------
187 // Compare 2 narrow oop values, returning condition codes (-1, 0 or 1).
188 class CmpNNode : public CmpNode {
189 public:
190   CmpNNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
191   virtual int Opcode() const;
192   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
193   virtual const Type *sub( const Type *, const Type * ) const;
194 };
195 
196 //------------------------------CmpLNode---------------------------------------
197 // Compare 2 long values, returning condition codes (-1, 0 or 1).
198 class CmpLNode : public CmpNode {
199 public:
200   CmpLNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
201   virtual int    Opcode() const;
202   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);

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

204 };
205 
206 //------------------------------CmpULNode---------------------------------------
207 // Compare 2 unsigned long values, returning condition codes (-1, 0 or 1).
208 class CmpULNode : public CmpNode {
209 public:
210   CmpULNode(Node* in1, Node* in2) : CmpNode(in1, in2) { }
211   virtual int Opcode() const;
212   virtual const Type* sub(const Type*, const Type*) const;
213 };
214 
215 //------------------------------CmpL3Node--------------------------------------
216 // Compare 2 long values, returning integer value (-1, 0 or 1).
217 class CmpL3Node : public CmpLNode {
218 public:
219   CmpL3Node( Node *in1, Node *in2 ) : CmpLNode(in1,in2) {
220     // Since it is not consumed by Bools, it is not really a Cmp.
221     init_class_id(Class_Sub);
222   }
223   virtual int    Opcode() const;

262   virtual int Opcode() const;
263   virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return NULL; }
264   const Type* Value(PhaseGVN* phase) const;
265   virtual Node  *Ideal(PhaseGVN *phase, bool can_reshape);
266 };
267 
268 //------------------------------CmpD3Node--------------------------------------
269 // Compare 2 double values, returning integer value (-1, 0 or 1).
270 // This implements the Java bytecode dcmpl, so unordered returns -1.
271 // Operands may not commute.
272 class CmpD3Node : public CmpDNode {
273 public:
274   CmpD3Node( Node *in1, Node *in2 ) : CmpDNode(in1,in2) {
275     // Since it is not consumed by Bools, it is not really a Cmp.
276     init_class_id(Class_Sub);
277   }
278   virtual int Opcode() const;
279   virtual uint ideal_reg() const { return Op_RegI; }
280 };
281 




















282 
283 //------------------------------BoolTest---------------------------------------
284 // Convert condition codes to a boolean test value (0 or -1).
285 // We pick the values as 3 bits; the low order 2 bits we compare against the
286 // condition codes, the high bit flips the sense of the result.
287 // For vector compares, additionally, the 4th bit indicates if the compare is unsigned
288 struct BoolTest {
289   enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, never = 8, illegal = 9,
290               // The following values are used with vector compares
291               // A BoolTest value should not be constructed for such values
292               unsigned_compare = 16,
293               ule = unsigned_compare | le, uge = unsigned_compare | ge, ult = unsigned_compare | lt, ugt = unsigned_compare | gt };
294   mask _test;
295   BoolTest( mask btm ) : _test(btm) { assert((btm & unsigned_compare) == 0, "unsupported");}
296   const Type *cc2logical( const Type *CC ) const;
297   // Commute the test.  I use a small table lookup.  The table is created as
298   // a simple char array where each element is the ASCII version of a 'mask'
299   // enum from above.
300   mask commute( ) const { return mask("032147658"[_test]-'0'); }
301   mask negate( ) const { return mask(_test^4); }

182   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
183   virtual const Type *sub( const Type *, const Type * ) const;
184 };
185 
186 //------------------------------CmpNNode--------------------------------------
187 // Compare 2 narrow oop values, returning condition codes (-1, 0 or 1).
188 class CmpNNode : public CmpNode {
189 public:
190   CmpNNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
191   virtual int Opcode() const;
192   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
193   virtual const Type *sub( const Type *, const Type * ) const;
194 };
195 
196 //------------------------------CmpLNode---------------------------------------
197 // Compare 2 long values, returning condition codes (-1, 0 or 1).
198 class CmpLNode : public CmpNode {
199 public:
200   CmpLNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
201   virtual int    Opcode() const;
202   virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
203   virtual const Type* Value(PhaseGVN* phase) const;
204   virtual const Type *sub( const Type *, const Type * ) const;
205   bool is_double_null_check(PhaseGVN* phase, Node*& a, Node*& b) const;
206 };
207 
208 //------------------------------CmpULNode---------------------------------------
209 // Compare 2 unsigned long values, returning condition codes (-1, 0 or 1).
210 class CmpULNode : public CmpNode {
211 public:
212   CmpULNode(Node* in1, Node* in2) : CmpNode(in1, in2) { }
213   virtual int Opcode() const;
214   virtual const Type* sub(const Type*, const Type*) const;
215 };
216 
217 //------------------------------CmpL3Node--------------------------------------
218 // Compare 2 long values, returning integer value (-1, 0 or 1).
219 class CmpL3Node : public CmpLNode {
220 public:
221   CmpL3Node( Node *in1, Node *in2 ) : CmpLNode(in1,in2) {
222     // Since it is not consumed by Bools, it is not really a Cmp.
223     init_class_id(Class_Sub);
224   }
225   virtual int    Opcode() const;

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