445 break; 446 } 447 return NULL; 448 } 449 450 //------------------------------Identity--------------------------------------- 451 Node* CastX2PNode::Identity(PhaseGVN* phase) { 452 if (in(1)->Opcode() == Op_CastP2X) return in(1)->in(1); 453 return this; 454 } 455 456 //============================================================================= 457 //------------------------------Value------------------------------------------ 458 const Type* CastP2XNode::Value(PhaseGVN* phase) const { 459 const Type* t = phase->type(in(1)); 460 if (t == Type::TOP) return Type::TOP; 461 if (t->base() == Type::RawPtr && t->singleton()) { 462 uintptr_t bits = (uintptr_t) t->is_rawptr()->get_con(); 463 return TypeX::make(bits); 464 } 465 return CastP2XNode::bottom_type(); 466 } 467 468 Node *CastP2XNode::Ideal(PhaseGVN *phase, bool can_reshape) { 469 return (in(0) && remove_dead_region(phase, can_reshape)) ? this : NULL; 470 } 471 472 //------------------------------Identity--------------------------------------- 473 Node* CastP2XNode::Identity(PhaseGVN* phase) { 474 if (in(1)->Opcode() == Op_CastX2P) return in(1)->in(1); 475 return this; 476 } | 445 break; 446 } 447 return NULL; 448 } 449 450 //------------------------------Identity--------------------------------------- 451 Node* CastX2PNode::Identity(PhaseGVN* phase) { 452 if (in(1)->Opcode() == Op_CastP2X) return in(1)->in(1); 453 return this; 454 } 455 456 //============================================================================= 457 //------------------------------Value------------------------------------------ 458 const Type* CastP2XNode::Value(PhaseGVN* phase) const { 459 const Type* t = phase->type(in(1)); 460 if (t == Type::TOP) return Type::TOP; 461 if (t->base() == Type::RawPtr && t->singleton()) { 462 uintptr_t bits = (uintptr_t) t->is_rawptr()->get_con(); 463 return TypeX::make(bits); 464 } 465 466 PhaseIterGVN* igvn = phase->is_IterGVN(); 467 if (igvn != NULL && (t->is_zero_type() || !TypePtr::NULL_PTR->higher_equal(t))) { 468 for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) { 469 Node* u = fast_out(i); 470 if (u->Opcode() == Op_OrL) { 471 for (DUIterator_Fast jmax, j = u->fast_outs(jmax); j < jmax; j++) { 472 Node* cmp = u->fast_out(j); 473 if (cmp->Opcode() == Op_CmpL) { 474 // Give CmpL a chance to get optimized 475 igvn->_worklist.push(cmp); 476 } 477 } 478 } 479 } 480 } 481 482 return CastP2XNode::bottom_type(); 483 } 484 485 Node *CastP2XNode::Ideal(PhaseGVN *phase, bool can_reshape) { 486 return (in(0) && remove_dead_region(phase, can_reshape)) ? this : NULL; 487 } 488 489 //------------------------------Identity--------------------------------------- 490 Node* CastP2XNode::Identity(PhaseGVN* phase) { 491 if (in(1)->Opcode() == Op_CastX2P) return in(1)->in(1); 492 return this; 493 } |