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