760
761 // This instruction captures the machine-independent bottom_type
762 // Expected use is for pointer vs oop determination for LoadP
763 bool InstructForm::captures_bottom_type(FormDict &globals) const {
764 if (_matrule && _matrule->_rChild &&
765 (!strcmp(_matrule->_rChild->_opType,"CastPP") || // new result type
766 !strcmp(_matrule->_rChild->_opType,"CastX2P") || // new result type
767 !strcmp(_matrule->_rChild->_opType,"DecodeN") ||
768 !strcmp(_matrule->_rChild->_opType,"EncodeP") ||
769 !strcmp(_matrule->_rChild->_opType,"DecodeNKlass") ||
770 !strcmp(_matrule->_rChild->_opType,"EncodePKlass") ||
771 !strcmp(_matrule->_rChild->_opType,"LoadN") ||
772 !strcmp(_matrule->_rChild->_opType,"LoadNKlass") ||
773 !strcmp(_matrule->_rChild->_opType,"CreateEx") || // type of exception
774 !strcmp(_matrule->_rChild->_opType,"CheckCastPP") ||
775 !strcmp(_matrule->_rChild->_opType,"GetAndSetP") ||
776 !strcmp(_matrule->_rChild->_opType,"GetAndSetN") ||
777 !strcmp(_matrule->_rChild->_opType,"CompareAndExchangeP") ||
778 !strcmp(_matrule->_rChild->_opType,"CompareAndExchangeN") ||
779 !strcmp(_matrule->_rChild->_opType,"ShenandoahCompareAndExchangeP") ||
780 !strcmp(_matrule->_rChild->_opType,"ShenandoahCompareAndExchangeN") ||
781 !strcmp(_matrule->_rChild->_opType,"ShenandoahReadBarrier"))) return true;
782 else if ( is_ideal_load() == Form::idealP ) return true;
783 else if ( is_ideal_store() != Form::none ) return true;
784
785 if (needs_base_oop_edge(globals)) return true;
786
787 if (is_vector()) return true;
788 if (is_mach_constant()) return true;
789
790 return false;
791 }
792
793
794 // Access instr_cost attribute or return NULL.
795 const char* InstructForm::cost() {
796 for (Attribute* cur = _attribs; cur != NULL; cur = (Attribute*)cur->_next) {
797 if( strcmp(cur->_ident,AttributeForm::_ins_cost) == 0 ) {
798 return cur->_val;
799 }
800 }
801 return NULL;
3489 }
3490
3491 int MatchNode::needs_ideal_memory_edge(FormDict &globals) const {
3492 static const char *needs_ideal_memory_list[] = {
3493 "StoreI","StoreL","StoreP","StoreN","StoreNKlass","StoreD","StoreF" ,
3494 "StoreB","StoreC","Store" ,"StoreFP",
3495 "LoadI", "LoadL", "LoadP" ,"LoadN", "LoadD" ,"LoadF" ,
3496 "LoadB" , "LoadUB", "LoadUS" ,"LoadS" ,"Load" ,
3497 "StoreVector", "LoadVector",
3498 "LoadRange", "LoadKlass", "LoadNKlass", "LoadL_unaligned", "LoadD_unaligned",
3499 "LoadPLocked",
3500 "StorePConditional", "StoreIConditional", "StoreLConditional",
3501 "CompareAndSwapB", "CompareAndSwapS", "CompareAndSwapI", "CompareAndSwapL", "CompareAndSwapP", "CompareAndSwapN",
3502 "WeakCompareAndSwapB", "WeakCompareAndSwapS", "WeakCompareAndSwapI", "WeakCompareAndSwapL", "WeakCompareAndSwapP", "WeakCompareAndSwapN",
3503 "CompareAndExchangeB", "CompareAndExchangeS", "CompareAndExchangeI", "CompareAndExchangeL", "CompareAndExchangeP", "CompareAndExchangeN",
3504 "ShenandoahCompareAndSwapN", "ShenandoahCompareAndSwapP", "ShenandoahWeakCompareAndSwapP", "ShenandoahWeakCompareAndSwapN", "ShenandoahCompareAndExchangeP", "ShenandoahCompareAndExchangeN",
3505 "StoreCM",
3506 "ClearArray",
3507 "GetAndSetB", "GetAndSetS", "GetAndAddI", "GetAndSetI", "GetAndSetP",
3508 "GetAndAddB", "GetAndAddS", "GetAndAddL", "GetAndSetL", "GetAndSetN",
3509 "ShenandoahReadBarrier",
3510 "LoadBarrierSlowReg", "LoadBarrierWeakSlowReg"
3511 };
3512 int cnt = sizeof(needs_ideal_memory_list)/sizeof(char*);
3513 if( strcmp(_opType,"PrefetchAllocation")==0 )
3514 return 1;
3515 if( _lChild ) {
3516 const char *opType = _lChild->_opType;
3517 for( int i=0; i<cnt; i++ )
3518 if( strcmp(opType,needs_ideal_memory_list[i]) == 0 )
3519 return 1;
3520 if( _lChild->needs_ideal_memory_edge(globals) )
3521 return 1;
3522 }
3523 if( _rChild ) {
3524 const char *opType = _rChild->_opType;
3525 for( int i=0; i<cnt; i++ )
3526 if( strcmp(opType,needs_ideal_memory_list[i]) == 0 )
3527 return 1;
3528 if( _rChild->needs_ideal_memory_edge(globals) )
3529 return 1;
|
760
761 // This instruction captures the machine-independent bottom_type
762 // Expected use is for pointer vs oop determination for LoadP
763 bool InstructForm::captures_bottom_type(FormDict &globals) const {
764 if (_matrule && _matrule->_rChild &&
765 (!strcmp(_matrule->_rChild->_opType,"CastPP") || // new result type
766 !strcmp(_matrule->_rChild->_opType,"CastX2P") || // new result type
767 !strcmp(_matrule->_rChild->_opType,"DecodeN") ||
768 !strcmp(_matrule->_rChild->_opType,"EncodeP") ||
769 !strcmp(_matrule->_rChild->_opType,"DecodeNKlass") ||
770 !strcmp(_matrule->_rChild->_opType,"EncodePKlass") ||
771 !strcmp(_matrule->_rChild->_opType,"LoadN") ||
772 !strcmp(_matrule->_rChild->_opType,"LoadNKlass") ||
773 !strcmp(_matrule->_rChild->_opType,"CreateEx") || // type of exception
774 !strcmp(_matrule->_rChild->_opType,"CheckCastPP") ||
775 !strcmp(_matrule->_rChild->_opType,"GetAndSetP") ||
776 !strcmp(_matrule->_rChild->_opType,"GetAndSetN") ||
777 !strcmp(_matrule->_rChild->_opType,"CompareAndExchangeP") ||
778 !strcmp(_matrule->_rChild->_opType,"CompareAndExchangeN") ||
779 !strcmp(_matrule->_rChild->_opType,"ShenandoahCompareAndExchangeP") ||
780 !strcmp(_matrule->_rChild->_opType,"ShenandoahCompareAndExchangeN"))) return true;
781 else if ( is_ideal_load() == Form::idealP ) return true;
782 else if ( is_ideal_store() != Form::none ) return true;
783
784 if (needs_base_oop_edge(globals)) return true;
785
786 if (is_vector()) return true;
787 if (is_mach_constant()) return true;
788
789 return false;
790 }
791
792
793 // Access instr_cost attribute or return NULL.
794 const char* InstructForm::cost() {
795 for (Attribute* cur = _attribs; cur != NULL; cur = (Attribute*)cur->_next) {
796 if( strcmp(cur->_ident,AttributeForm::_ins_cost) == 0 ) {
797 return cur->_val;
798 }
799 }
800 return NULL;
3488 }
3489
3490 int MatchNode::needs_ideal_memory_edge(FormDict &globals) const {
3491 static const char *needs_ideal_memory_list[] = {
3492 "StoreI","StoreL","StoreP","StoreN","StoreNKlass","StoreD","StoreF" ,
3493 "StoreB","StoreC","Store" ,"StoreFP",
3494 "LoadI", "LoadL", "LoadP" ,"LoadN", "LoadD" ,"LoadF" ,
3495 "LoadB" , "LoadUB", "LoadUS" ,"LoadS" ,"Load" ,
3496 "StoreVector", "LoadVector",
3497 "LoadRange", "LoadKlass", "LoadNKlass", "LoadL_unaligned", "LoadD_unaligned",
3498 "LoadPLocked",
3499 "StorePConditional", "StoreIConditional", "StoreLConditional",
3500 "CompareAndSwapB", "CompareAndSwapS", "CompareAndSwapI", "CompareAndSwapL", "CompareAndSwapP", "CompareAndSwapN",
3501 "WeakCompareAndSwapB", "WeakCompareAndSwapS", "WeakCompareAndSwapI", "WeakCompareAndSwapL", "WeakCompareAndSwapP", "WeakCompareAndSwapN",
3502 "CompareAndExchangeB", "CompareAndExchangeS", "CompareAndExchangeI", "CompareAndExchangeL", "CompareAndExchangeP", "CompareAndExchangeN",
3503 "ShenandoahCompareAndSwapN", "ShenandoahCompareAndSwapP", "ShenandoahWeakCompareAndSwapP", "ShenandoahWeakCompareAndSwapN", "ShenandoahCompareAndExchangeP", "ShenandoahCompareAndExchangeN",
3504 "StoreCM",
3505 "ClearArray",
3506 "GetAndSetB", "GetAndSetS", "GetAndAddI", "GetAndSetI", "GetAndSetP",
3507 "GetAndAddB", "GetAndAddS", "GetAndAddL", "GetAndSetL", "GetAndSetN",
3508 "LoadBarrierSlowReg", "LoadBarrierWeakSlowReg"
3509 };
3510 int cnt = sizeof(needs_ideal_memory_list)/sizeof(char*);
3511 if( strcmp(_opType,"PrefetchAllocation")==0 )
3512 return 1;
3513 if( _lChild ) {
3514 const char *opType = _lChild->_opType;
3515 for( int i=0; i<cnt; i++ )
3516 if( strcmp(opType,needs_ideal_memory_list[i]) == 0 )
3517 return 1;
3518 if( _lChild->needs_ideal_memory_edge(globals) )
3519 return 1;
3520 }
3521 if( _rChild ) {
3522 const char *opType = _rChild->_opType;
3523 for( int i=0; i<cnt; i++ )
3524 if( strcmp(opType,needs_ideal_memory_list[i]) == 0 )
3525 return 1;
3526 if( _rChild->needs_ideal_memory_edge(globals) )
3527 return 1;
|