269 mask _test; 270 BoolTest( mask btm ) : _test(btm) {} 271 const Type *cc2logical( const Type *CC ) const; 272 // Commute the test. I use a small table lookup. The table is created as 273 // a simple char array where each element is the ASCII version of a 'mask' 274 // enum from above. 275 mask commute( ) const { return mask("032147658"[_test]-'0'); } 276 mask negate( ) const { return mask(_test^4); } 277 bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le || _test == BoolTest::overflow); } 278 #ifndef PRODUCT 279 void dump_on(outputStream *st) const; 280 #endif 281 }; 282 283 //------------------------------BoolNode--------------------------------------- 284 // A Node to convert a Condition Codes to a Logical result. 285 class BoolNode : public Node { 286 virtual uint hash() const; 287 virtual uint cmp( const Node &n ) const; 288 virtual uint size_of() const; 289 public: 290 const BoolTest _test; 291 BoolNode( Node *cc, BoolTest::mask t): _test(t), Node(0,cc) { 292 init_class_id(Class_Bool); 293 } 294 // Convert an arbitrary int value to a Bool or other suitable predicate. 295 static Node* make_predicate(Node* test_value, PhaseGVN* phase); 296 // Convert self back to an integer value. 297 Node* as_int_value(PhaseGVN* phase); 298 // Invert sense of self, returning new Bool. 299 BoolNode* negate(PhaseGVN* phase); 300 virtual int Opcode() const; 301 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 302 virtual const Type *Value( PhaseTransform *phase ) const; 303 virtual const Type *bottom_type() const { return TypeInt::BOOL; } 304 uint match_edge(uint idx) const { return 0; } 305 virtual uint ideal_reg() const { return Op_RegI; } 306 307 bool is_counted_loop_exit_test(); 308 #ifndef PRODUCT | 269 mask _test; 270 BoolTest( mask btm ) : _test(btm) {} 271 const Type *cc2logical( const Type *CC ) const; 272 // Commute the test. I use a small table lookup. The table is created as 273 // a simple char array where each element is the ASCII version of a 'mask' 274 // enum from above. 275 mask commute( ) const { return mask("032147658"[_test]-'0'); } 276 mask negate( ) const { return mask(_test^4); } 277 bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le || _test == BoolTest::overflow); } 278 #ifndef PRODUCT 279 void dump_on(outputStream *st) const; 280 #endif 281 }; 282 283 //------------------------------BoolNode--------------------------------------- 284 // A Node to convert a Condition Codes to a Logical result. 285 class BoolNode : public Node { 286 virtual uint hash() const; 287 virtual uint cmp( const Node &n ) const; 288 virtual uint size_of() const; 289 290 // Try to optimize signed integer comparison 291 Node* fold_cmpI(PhaseGVN* phase, Node* cmp, Node* cmp1, Node* cmp2, 292 int cmp_op, int cmp1_op, const TypeInt* cmp2_type); 293 public: 294 const BoolTest _test; 295 BoolNode( Node *cc, BoolTest::mask t): _test(t), Node(0,cc) { 296 init_class_id(Class_Bool); 297 } 298 // Convert an arbitrary int value to a Bool or other suitable predicate. 299 static Node* make_predicate(Node* test_value, PhaseGVN* phase); 300 // Convert self back to an integer value. 301 Node* as_int_value(PhaseGVN* phase); 302 // Invert sense of self, returning new Bool. 303 BoolNode* negate(PhaseGVN* phase); 304 virtual int Opcode() const; 305 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 306 virtual const Type *Value( PhaseTransform *phase ) const; 307 virtual const Type *bottom_type() const { return TypeInt::BOOL; } 308 uint match_edge(uint idx) const { return 0; } 309 virtual uint ideal_reg() const { return Op_RegI; } 310 311 bool is_counted_loop_exit_test(); 312 #ifndef PRODUCT |