697 if (addr->in(AddPNode::Base) != base) { 698 // give up 699 return -1; 700 } 701 elements[count++] = addr->in(AddPNode::Offset); 702 if (count == length) { 703 // give up 704 return -1; 705 } 706 addr = addr->in(AddPNode::Address); 707 } 708 return count; 709 } 710 711 //------------------------------match_edge------------------------------------- 712 // Do we Match on this edge index or not? Do not match base pointer edge 713 uint AddPNode::match_edge(uint idx) const { 714 return idx > Base; 715 } 716 717 //---------------------------mach_bottom_type---------------------------------- 718 // Utility function for use by ADLC. Implements bottom_type for matched AddP. 719 const Type *AddPNode::mach_bottom_type( const MachNode* n) { 720 Node* base = n->in(Base); 721 const Type *t = base->bottom_type(); 722 if ( t == Type::TOP ) { 723 // an untyped pointer 724 return TypeRawPtr::BOTTOM; 725 } 726 const TypePtr* tp = t->isa_oopptr(); 727 if ( tp == NULL ) return t; 728 if ( tp->_offset == TypePtr::OffsetBot ) return tp; 729 730 // We must carefully add up the various offsets... 731 intptr_t offset = 0; 732 const TypePtr* tptr = NULL; 733 734 uint numopnds = n->num_opnds(); 735 uint index = n->oper_input_base(); 736 for ( uint i = 1; i < numopnds; i++ ) { 737 MachOper *opnd = n->_opnds[i]; 738 // Check for any interesting operand info. 739 // In particular, check for both memory and non-memory operands. 740 // %%%%% Clean this up: use xadd_offset 741 intptr_t con = opnd->constant(); 742 if ( con == TypePtr::OffsetBot ) goto bottom_out; 743 offset += con; 744 con = opnd->constant_disp(); 745 if ( con == TypePtr::OffsetBot ) goto bottom_out; 746 offset += con; 747 if( opnd->scale() != 0 ) goto bottom_out; 748 749 // Check each operand input edge. Find the 1 allowed pointer 750 // edge. Other edges must be index edges; track exact constant 751 // inputs and otherwise assume the worst. 752 for ( uint j = opnd->num_edges(); j > 0; j-- ) { 753 Node* edge = n->in(index++); 754 const Type* et = edge->bottom_type(); 755 const TypeX* eti = et->isa_intptr_t(); 756 if ( eti == NULL ) { 757 // there must be one pointer among the operands 758 guarantee(tptr == NULL, "must be only one pointer operand"); 759 if (UseCompressedOops && Universe::narrow_oop_shift() == 0) { 760 // 32-bits narrow oop can be the base of address expressions 761 tptr = et->make_ptr()->isa_oopptr(); 762 } else { 763 // only regular oops are expected here 764 tptr = et->isa_oopptr(); 765 } 766 guarantee(tptr != NULL, "non-int operand must be pointer"); 767 if (tptr->higher_equal(tp->add_offset(tptr->offset()))) 768 tp = tptr; // Set more precise type for bailout 769 continue; 770 } 771 if ( eti->_hi != eti->_lo ) goto bottom_out; 772 offset += eti->_lo; 773 } 774 } 775 guarantee(tptr != NULL, "must be exactly one pointer operand"); 776 return tptr->add_offset(offset); 777 778 bottom_out: 779 return tp->add_offset(TypePtr::OffsetBot); 780 } 781 782 //============================================================================= 783 //------------------------------Identity--------------------------------------- 784 Node *OrINode::Identity( PhaseTransform *phase ) { 785 // x | x => x 786 if (phase->eqv(in(1), in(2))) { 787 return in(1); 788 } 789 790 return AddNode::Identity(phase); 791 } 792 793 //------------------------------add_ring--------------------------------------- 794 // Supplied function returns the sum of the inputs IN THE CURRENT RING. For 795 // the logical operations the ring's ADD is really a logical OR function. 796 // This also type-checks the inputs for sanity. Guaranteed never to 797 // be passed a TOP or BOTTOM type, these are filtered out by pre-check. 798 const Type *OrINode::add_ring( const Type *t0, const Type *t1 ) const { 799 const TypeInt *r0 = t0->is_int(); // Handy access 800 const TypeInt *r1 = t1->is_int(); 801 | 697 if (addr->in(AddPNode::Base) != base) { 698 // give up 699 return -1; 700 } 701 elements[count++] = addr->in(AddPNode::Offset); 702 if (count == length) { 703 // give up 704 return -1; 705 } 706 addr = addr->in(AddPNode::Address); 707 } 708 return count; 709 } 710 711 //------------------------------match_edge------------------------------------- 712 // Do we Match on this edge index or not? Do not match base pointer edge 713 uint AddPNode::match_edge(uint idx) const { 714 return idx > Base; 715 } 716 717 //============================================================================= 718 //------------------------------Identity--------------------------------------- 719 Node *OrINode::Identity( PhaseTransform *phase ) { 720 // x | x => x 721 if (phase->eqv(in(1), in(2))) { 722 return in(1); 723 } 724 725 return AddNode::Identity(phase); 726 } 727 728 //------------------------------add_ring--------------------------------------- 729 // Supplied function returns the sum of the inputs IN THE CURRENT RING. For 730 // the logical operations the ring's ADD is really a logical OR function. 731 // This also type-checks the inputs for sanity. Guaranteed never to 732 // be passed a TOP or BOTTOM type, these are filtered out by pre-check. 733 const Type *OrINode::add_ring( const Type *t0, const Type *t1 ) const { 734 const TypeInt *r0 = t0->is_int(); // Handy access 735 const TypeInt *r1 = t1->is_int(); 736 |