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;
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); }
|
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* Value(PhaseGVN* phase) const;
210 virtual const Type *sub( const Type *, const Type * ) const;
211 bool is_double_null_check(PhaseGVN* phase, Node*& a, Node*& b) const;
212 };
213
214 //------------------------------CmpULNode---------------------------------------
215 // Compare 2 unsigned long values, returning condition codes (-1, 0 or 1).
216 class CmpULNode : public CmpNode {
217 public:
218 CmpULNode(Node* in1, Node* in2) : CmpNode(in1, in2) { }
219 virtual int Opcode() const;
220 virtual const Type* sub(const Type*, const Type*) const;
221 };
222
223 //------------------------------CmpL3Node--------------------------------------
224 // Compare 2 long values, returning integer value (-1, 0 or 1).
225 class CmpL3Node : public CmpLNode {
226 public:
227 CmpL3Node( Node *in1, Node *in2 ) : CmpLNode(in1,in2) {
228 // Since it is not consumed by Bools, it is not really a Cmp.
229 init_class_id(Class_Sub);
230 }
231 virtual int Opcode() const;
282 virtual int Opcode() const;
283 virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return nullptr; }
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 //--------------------------FlatArrayCheckNode---------------------------------
303 // Returns true if one of the input array objects or array klass ptrs (there
304 // can be multiple) is flat.
305 class FlatArrayCheckNode : public CmpNode {
306 public:
307 enum {
308 Control,
309 Memory,
310 ArrayOrKlass
311 };
312 FlatArrayCheckNode(Compile* C, Node* mem, Node* array_or_klass) : CmpNode(mem, array_or_klass) {
313 init_class_id(Class_FlatArrayCheck);
314 init_flags(Flag_is_macro);
315 C->add_macro_node(this);
316 }
317 virtual int Opcode() const;
318 virtual const Type* sub(const Type*, const Type*) const { ShouldNotReachHere(); return nullptr; }
319 const Type* Value(PhaseGVN* phase) const;
320 virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
321 };
322
323 //------------------------------BoolTest---------------------------------------
324 // Convert condition codes to a boolean test value (0 or -1).
325 // We pick the values as 3 bits; the low order 2 bits we compare against the
326 // condition codes, the high bit flips the sense of the result.
327 // For vector compares, additionally, the 4th bit indicates if the compare is unsigned
328 struct BoolTest {
329 enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, never = 8, illegal = 9,
330 // The following values are used with vector compares
331 // A BoolTest value should not be constructed for such values
332 unsigned_compare = 16,
333 ule = unsigned_compare | le, uge = unsigned_compare | ge, ult = unsigned_compare | lt, ugt = unsigned_compare | gt };
334 mask _test;
335 BoolTest( mask btm ) : _test(btm) { assert((btm & unsigned_compare) == 0, "unsupported");}
336 const Type *cc2logical( const Type *CC ) const;
337 // Commute the test. I use a small table lookup. The table is created as
338 // a simple char array where each element is the ASCII version of a 'mask'
339 // enum from above.
340 mask commute( ) const { return mask("032147658"[_test]-'0'); }
341 mask negate( ) const { return mask(_test^4); }
|