Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/addnode.cpp @ 1543:1a1603f975b5
Merge
author | kvn |
---|---|
date | Wed, 19 May 2010 10:22:39 -0700 |
parents | b5fdf39b9749 |
children | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
1542:eb79484f795f | 1543:1a1603f975b5 |
---|---|
712 // Do we Match on this edge index or not? Do not match base pointer 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 { | 713 uint AddPNode::match_edge(uint idx) const { |
714 return idx > Base; | 714 return idx > Base; |
715 } | 715 } |
716 | 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 //============================================================================= | 717 //============================================================================= |
783 //------------------------------Identity--------------------------------------- | 718 //------------------------------Identity--------------------------------------- |
784 Node *OrINode::Identity( PhaseTransform *phase ) { | 719 Node *OrINode::Identity( PhaseTransform *phase ) { |
785 // x | x => x | 720 // x | x => x |
786 if (phase->eqv(in(1), in(2))) { | 721 if (phase->eqv(in(1), in(2))) { |