1235 1236 if( CC == TypeInt::CC_GE ) { 1237 if( _test == ge ) return TypeInt::ONE; 1238 if( _test == lt ) return TypeInt::ZERO; 1239 } 1240 if( CC == TypeInt::CC_LE ) { 1241 if( _test == le ) return TypeInt::ONE; 1242 if( _test == gt ) return TypeInt::ZERO; 1243 } 1244 1245 return TypeInt::BOOL; 1246 } 1247 1248 //------------------------------dump_spec------------------------------------- 1249 // Print special per-node info 1250 void BoolTest::dump_on(outputStream *st) const { 1251 const char *msg[] = {"eq","gt","of","lt","ne","le","nof","ge"}; 1252 st->print("%s", msg[_test]); 1253 } 1254 1255 //============================================================================= 1256 uint BoolNode::hash() const { return (Node::hash() << 3)|(_test._test+1); } 1257 uint BoolNode::size_of() const { return sizeof(BoolNode); } 1258 1259 //------------------------------operator==------------------------------------- 1260 uint BoolNode::cmp( const Node &n ) const { 1261 const BoolNode *b = (const BoolNode *)&n; // Cast up 1262 return (_test._test == b->_test._test); 1263 } 1264 1265 //-------------------------------make_predicate-------------------------------- 1266 Node* BoolNode::make_predicate(Node* test_value, PhaseGVN* phase) { 1267 if (test_value->is_Con()) return test_value; 1268 if (test_value->is_Bool()) return test_value; 1269 if (test_value->is_CMove() && 1270 test_value->in(CMoveNode::Condition)->is_Bool()) { 1271 BoolNode* bol = test_value->in(CMoveNode::Condition)->as_Bool(); 1272 const Type* ftype = phase->type(test_value->in(CMoveNode::IfFalse)); 1273 const Type* ttype = phase->type(test_value->in(CMoveNode::IfTrue)); 1274 if (ftype == TypeInt::ZERO && !TypeInt::ZERO->higher_equal(ttype)) { | 1235 1236 if( CC == TypeInt::CC_GE ) { 1237 if( _test == ge ) return TypeInt::ONE; 1238 if( _test == lt ) return TypeInt::ZERO; 1239 } 1240 if( CC == TypeInt::CC_LE ) { 1241 if( _test == le ) return TypeInt::ONE; 1242 if( _test == gt ) return TypeInt::ZERO; 1243 } 1244 1245 return TypeInt::BOOL; 1246 } 1247 1248 //------------------------------dump_spec------------------------------------- 1249 // Print special per-node info 1250 void BoolTest::dump_on(outputStream *st) const { 1251 const char *msg[] = {"eq","gt","of","lt","ne","le","nof","ge"}; 1252 st->print("%s", msg[_test]); 1253 } 1254 1255 // Returns the logical AND of two tests (or 'never' if both tests can never be true). 1256 // For example, a test for 'le' followed by a test for 'lt' is equivalent with 'lt'. 1257 BoolTest::mask BoolTest::merge(BoolTest other) const { 1258 const mask res[illegal+1][illegal+1] = { 1259 // eq, gt, of, lt, ne, le, nof, ge, never, illegal 1260 {eq, never, illegal, never, never, eq, illegal, eq, never, illegal}, // eq 1261 {never, gt, illegal, never, gt, never, illegal, gt, never, illegal}, // gt 1262 {illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, never, illegal}, // of 1263 {never, never, illegal, lt, lt, lt, illegal, never, never, illegal}, // lt 1264 {never, gt, illegal, lt, ne, lt, illegal, gt, never, illegal}, // ne 1265 {eq, never, illegal, lt, lt, le, illegal, eq, never, illegal}, // le 1266 {illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, never, illegal}, // nof 1267 {eq, gt, illegal, never, gt, eq, illegal, ge, never, illegal}, // ge 1268 {never, never, never, never, never, never, never, never, never, illegal}, // never 1269 {illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal}}; // illegal 1270 return res[_test][other._test]; 1271 } 1272 1273 //============================================================================= 1274 uint BoolNode::hash() const { return (Node::hash() << 3)|(_test._test+1); } 1275 uint BoolNode::size_of() const { return sizeof(BoolNode); } 1276 1277 //------------------------------operator==------------------------------------- 1278 uint BoolNode::cmp( const Node &n ) const { 1279 const BoolNode *b = (const BoolNode *)&n; // Cast up 1280 return (_test._test == b->_test._test); 1281 } 1282 1283 //-------------------------------make_predicate-------------------------------- 1284 Node* BoolNode::make_predicate(Node* test_value, PhaseGVN* phase) { 1285 if (test_value->is_Con()) return test_value; 1286 if (test_value->is_Bool()) return test_value; 1287 if (test_value->is_CMove() && 1288 test_value->in(CMoveNode::Condition)->is_Bool()) { 1289 BoolNode* bol = test_value->in(CMoveNode::Condition)->as_Bool(); 1290 const Type* ftype = phase->type(test_value->in(CMoveNode::IfFalse)); 1291 const Type* ttype = phase->type(test_value->in(CMoveNode::IfTrue)); 1292 if (ftype == TypeInt::ZERO && !TypeInt::ZERO->higher_equal(ttype)) { |