200 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
201 virtual const Type *sub( const Type *, const Type * ) const;
202 };
203
204 //------------------------------CmpNNode--------------------------------------
205 // Compare 2 narrow oop values, returning condition codes (-1, 0 or 1).
206 class CmpNNode : public CmpNode {
207 public:
208 CmpNNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
209 virtual int Opcode() const;
210 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
211 virtual const Type *sub( const Type *, const Type * ) const;
212 };
213
214 //------------------------------CmpLNode---------------------------------------
215 // Compare 2 long values, returning condition codes (-1, 0 or 1).
216 class CmpLNode : public CmpNode {
217 public:
218 CmpLNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
219 virtual int Opcode() const;
220 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
221 virtual const Type *sub( const Type *, const Type * ) const;
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 };
232
233 //------------------------------CmpL3Node--------------------------------------
234 // Compare 2 long values, returning integer value (-1, 0 or 1).
235 class CmpL3Node : public CmpLNode {
236 public:
237 CmpL3Node( Node *in1, Node *in2 ) : CmpLNode(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;
292 virtual int Opcode() const;
293 virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return nullptr; }
294 const Type* Value(PhaseGVN* phase) const;
295 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
296 };
297
298 //------------------------------CmpD3Node--------------------------------------
299 // Compare 2 double values, returning integer value (-1, 0 or 1).
300 // This implements the Java bytecode dcmpl, so unordered returns -1.
301 // Operands may not commute.
302 class CmpD3Node : public CmpDNode {
303 public:
304 CmpD3Node( Node *in1, Node *in2 ) : CmpDNode(in1,in2) {
305 // Since it is not consumed by Bools, it is not really a Cmp.
306 init_class_id(Class_Sub);
307 }
308 virtual int Opcode() const;
309 virtual uint ideal_reg() const { return Op_RegI; }
310 };
311
312
313 //------------------------------BoolTest---------------------------------------
314 // Convert condition codes to a boolean test value (0 or -1).
315 // We pick the values as 3 bits; the low order 2 bits we compare against the
316 // condition codes, the high bit flips the sense of the result.
317 // For vector compares, additionally, the 4th bit indicates if the compare is unsigned
318 struct BoolTest {
319 enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, never = 8, illegal = 9,
320 // The following values are used with vector compares
321 // A BoolTest value should not be constructed for such values
322 unsigned_compare = 16,
323 ule = unsigned_compare | le, uge = unsigned_compare | ge, ult = unsigned_compare | lt, ugt = unsigned_compare | gt };
324 mask _test;
325 BoolTest( mask btm ) : _test(btm) { assert((btm & unsigned_compare) == 0, "unsupported");}
326 const Type *cc2logical( const Type *CC ) const;
327 // Commute the test. I use a small table lookup. The table is created as
328 // a simple char array where each element is the ASCII version of a 'mask'
329 // enum from above.
330 mask commute( ) const { return mask("032147658"[_test]-'0'); }
331 mask negate( ) const { return mask(_test^4); }
|
200 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
201 virtual const Type *sub( const Type *, const Type * ) const;
202 };
203
204 //------------------------------CmpNNode--------------------------------------
205 // Compare 2 narrow oop values, returning condition codes (-1, 0 or 1).
206 class CmpNNode : public CmpNode {
207 public:
208 CmpNNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
209 virtual int Opcode() const;
210 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
211 virtual const Type *sub( const Type *, const Type * ) const;
212 };
213
214 //------------------------------CmpLNode---------------------------------------
215 // Compare 2 long values, returning condition codes (-1, 0 or 1).
216 class CmpLNode : public CmpNode {
217 public:
218 CmpLNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
219 virtual int Opcode() const;
220 virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
221 virtual const Type* Value(PhaseGVN* phase) const;
222 virtual const Type *sub( const Type *, const Type * ) const;
223 bool is_double_null_check(PhaseGVN* phase, Node*& a, Node*& b) const;
224 };
225
226 //------------------------------CmpULNode---------------------------------------
227 // Compare 2 unsigned long values, returning condition codes (-1, 0 or 1).
228 class CmpULNode : public CmpNode {
229 public:
230 CmpULNode(Node* in1, Node* in2) : CmpNode(in1, in2) { }
231 virtual int Opcode() const;
232 virtual const Type* sub(const Type*, const Type*) const;
233 };
234
235 //------------------------------CmpL3Node--------------------------------------
236 // Compare 2 long values, returning integer value (-1, 0 or 1).
237 class CmpL3Node : public CmpLNode {
238 public:
239 CmpL3Node( Node *in1, Node *in2 ) : CmpLNode(in1,in2) {
240 // Since it is not consumed by Bools, it is not really a Cmp.
241 init_class_id(Class_Sub);
242 }
243 virtual int Opcode() const;
294 virtual int Opcode() const;
295 virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return nullptr; }
296 const Type* Value(PhaseGVN* phase) const;
297 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
298 };
299
300 //------------------------------CmpD3Node--------------------------------------
301 // Compare 2 double values, returning integer value (-1, 0 or 1).
302 // This implements the Java bytecode dcmpl, so unordered returns -1.
303 // Operands may not commute.
304 class CmpD3Node : public CmpDNode {
305 public:
306 CmpD3Node( Node *in1, Node *in2 ) : CmpDNode(in1,in2) {
307 // Since it is not consumed by Bools, it is not really a Cmp.
308 init_class_id(Class_Sub);
309 }
310 virtual int Opcode() const;
311 virtual uint ideal_reg() const { return Op_RegI; }
312 };
313
314 //--------------------------FlatArrayCheckNode---------------------------------
315 // Returns true if one of the input array objects or array klass ptrs (there
316 // can be multiple) is flat.
317 class FlatArrayCheckNode : public CmpNode {
318 public:
319 enum {
320 Control,
321 Memory,
322 ArrayOrKlass
323 };
324 FlatArrayCheckNode(Compile* C, Node* mem, Node* array_or_klass) : CmpNode(mem, array_or_klass) {
325 init_class_id(Class_FlatArrayCheck);
326 init_flags(Flag_is_macro);
327 C->add_macro_node(this);
328 }
329 virtual int Opcode() const;
330 virtual const Type* sub(const Type*, const Type*) const { ShouldNotReachHere(); return nullptr; }
331 const Type* Value(PhaseGVN* phase) const;
332 virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
333 };
334
335 //------------------------------BoolTest---------------------------------------
336 // Convert condition codes to a boolean test value (0 or -1).
337 // We pick the values as 3 bits; the low order 2 bits we compare against the
338 // condition codes, the high bit flips the sense of the result.
339 // For vector compares, additionally, the 4th bit indicates if the compare is unsigned
340 struct BoolTest {
341 enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, never = 8, illegal = 9,
342 // The following values are used with vector compares
343 // A BoolTest value should not be constructed for such values
344 unsigned_compare = 16,
345 ule = unsigned_compare | le, uge = unsigned_compare | ge, ult = unsigned_compare | lt, ugt = unsigned_compare | gt };
346 mask _test;
347 BoolTest( mask btm ) : _test(btm) { assert((btm & unsigned_compare) == 0, "unsupported");}
348 const Type *cc2logical( const Type *CC ) const;
349 // Commute the test. I use a small table lookup. The table is created as
350 // a simple char array where each element is the ASCII version of a 'mask'
351 // enum from above.
352 mask commute( ) const { return mask("032147658"[_test]-'0'); }
353 mask negate( ) const { return mask(_test^4); }
|