< prev index next >

src/hotspot/share/adlc/formssel.cpp

Print this page




 624     if( !form ) continue;
 625     OpClassForm *op   = form->is_opclass();
 626     if( !op ) continue;
 627     if( form->interface_type(globals) == Form::memory_interface ) {
 628       if( comp->isa(Component::USE) ) USE_of_memory = true;
 629       if( comp->isa(Component::DEF) ) {
 630         OperandForm *oper = form->is_operand();
 631         if( oper && oper->is_user_name_for_sReg() ) {
 632           // Stack slots are unaliased memory handled by allocator
 633           oper = oper;  // debug stopping point !!!!!
 634         } else {
 635           DEF_of_memory = true;
 636         }
 637       }
 638     }
 639   }
 640   return (USE_of_memory && !DEF_of_memory);
 641 }
 642 
 643 
 644 bool InstructForm::is_wide_memory_kill(FormDict &globals) const {
 645   if( _matrule == NULL ) return false;
 646   if( !_matrule->_opType ) return false;
 647 
 648   if( strcmp(_matrule->_opType,"MemBarRelease") == 0 ) return true;
 649   if( strcmp(_matrule->_opType,"MemBarAcquire") == 0 ) return true;
 650   if( strcmp(_matrule->_opType,"MemBarReleaseLock") == 0 ) return true;
 651   if( strcmp(_matrule->_opType,"MemBarAcquireLock") == 0 ) return true;
 652   if( strcmp(_matrule->_opType,"MemBarStoreStore") == 0 ) return true;
 653   if( strcmp(_matrule->_opType,"MemBarVolatile") == 0 ) return true;
 654   if( strcmp(_matrule->_opType,"StoreFence") == 0 ) return true;
 655   if( strcmp(_matrule->_opType,"LoadFence") == 0 ) return true;
 656 
 657   return false;
 658 }
 659 
 660 int InstructForm::memory_operand(FormDict &globals) const {
 661   // Machine independent loads must be checked for anti-dependences
 662   // Check if instruction has a USE of a memory operand class, or a def.
 663   int USE_of_memory  = 0;
 664   int DEF_of_memory  = 0;
 665   const char*    last_memory_DEF = NULL; // to test DEF/USE pairing in asserts
 666   const char*    last_memory_USE = NULL;
 667   Component     *unique          = NULL;
 668   Component     *comp            = NULL;
 669   ComponentList &components      = (ComponentList &)_components;
 670 
 671   components.reset();
 672   while( (comp = components.iter()) != NULL ) {
 673     const Form  *form = globals[comp->_type];
 674     if( !form ) continue;
 675     OpClassForm *op   = form->is_opclass();
 676     if( !op ) continue;
 677     if( op->stack_slots_only(globals) )  continue;
 678     if( form->interface_type(globals) == Form::memory_interface ) {
 679       if( comp->isa(Component::DEF) ) {


 773   return NO_MEMORY_OPERAND;
 774 }
 775 
 776 
 777 // This instruction captures the machine-independent bottom_type
 778 // Expected use is for pointer vs oop determination for LoadP
 779 bool InstructForm::captures_bottom_type(FormDict &globals) const {
 780   if (_matrule && _matrule->_rChild &&
 781       (!strcmp(_matrule->_rChild->_opType,"CastPP")       ||  // new result type
 782        !strcmp(_matrule->_rChild->_opType,"CastX2P")      ||  // new result type
 783        !strcmp(_matrule->_rChild->_opType,"DecodeN")      ||
 784        !strcmp(_matrule->_rChild->_opType,"EncodeP")      ||
 785        !strcmp(_matrule->_rChild->_opType,"DecodeNKlass") ||
 786        !strcmp(_matrule->_rChild->_opType,"EncodePKlass") ||
 787        !strcmp(_matrule->_rChild->_opType,"LoadN")        ||
 788        !strcmp(_matrule->_rChild->_opType,"LoadNKlass")   ||
 789        !strcmp(_matrule->_rChild->_opType,"CreateEx")     ||  // type of exception
 790        !strcmp(_matrule->_rChild->_opType,"CheckCastPP")  ||
 791        !strcmp(_matrule->_rChild->_opType,"GetAndSetP")   ||
 792        !strcmp(_matrule->_rChild->_opType,"GetAndSetN")   ||





 793        !strcmp(_matrule->_rChild->_opType,"CompareAndExchangeP") ||
 794        !strcmp(_matrule->_rChild->_opType,"CompareAndExchangeN")))  return true;
 795   else if ( is_ideal_load() == Form::idealP )                return true;
 796   else if ( is_ideal_store() != Form::none  )                return true;
 797 
 798   if (needs_base_oop_edge(globals)) return true;
 799 
 800   if (is_vector()) return true;
 801   if (is_mach_constant()) return true;
 802 
 803   return  false;
 804 }
 805 
 806 
 807 // Access instr_cost attribute or return NULL.
 808 const char* InstructForm::cost() {
 809   for (Attribute* cur = _attribs; cur != NULL; cur = (Attribute*)cur->_next) {
 810     if( strcmp(cur->_ident,AttributeForm::_ins_cost) == 0 ) {
 811       return cur->_val;
 812     }
 813   }
 814   return NULL;


1156     return "MachReturnNode";
1157   }
1158   else if (is_ideal_halt()) {
1159     return "MachHaltNode";
1160   }
1161   else if (is_ideal_safepoint()) {
1162     return "MachSafePointNode";
1163   }
1164   else if (is_ideal_if()) {
1165     return "MachIfNode";
1166   }
1167   else if (is_ideal_goto()) {
1168     return "MachGotoNode";
1169   }
1170   else if (is_ideal_fastlock()) {
1171     return "MachFastLockNode";
1172   }
1173   else if (is_ideal_nop()) {
1174     return "MachNopNode";
1175   }



1176   else if (is_ideal_jump()) {
1177     return "MachJumpNode";
1178   }
1179   else if (is_mach_constant()) {
1180     return "MachConstantNode";
1181   }
1182   else if (captures_bottom_type(globals)) {
1183     return "MachTypeNode";
1184   } else {
1185     return "MachNode";
1186   }
1187   assert( false, "ShouldNotReachHere()");
1188   return NULL;
1189 }
1190 
1191 // Compare the instruction predicates for textual equality
1192 bool equivalent_predicates( const InstructForm *instr1, const InstructForm *instr2 ) {
1193   const Predicate *pred1  = instr1->_predicate;
1194   const Predicate *pred2  = instr2->_predicate;
1195   if( pred1 == NULL && pred2 == NULL ) {


3498   }
3499 }
3500 
3501 int MatchNode::needs_ideal_memory_edge(FormDict &globals) const {
3502   static const char *needs_ideal_memory_list[] = {
3503     "StoreI","StoreL","StoreP","StoreN","StoreNKlass","StoreD","StoreF" ,
3504     "StoreB","StoreC","Store" ,"StoreFP",
3505     "LoadI", "LoadL", "LoadP" ,"LoadN", "LoadD" ,"LoadF"  ,
3506     "LoadB" , "LoadUB", "LoadUS" ,"LoadS" ,"Load" ,
3507     "StoreVector", "LoadVector",
3508     "LoadRange", "LoadKlass", "LoadNKlass", "LoadL_unaligned", "LoadD_unaligned",
3509     "LoadPLocked",
3510     "StorePConditional", "StoreIConditional", "StoreLConditional",
3511     "CompareAndSwapB", "CompareAndSwapS", "CompareAndSwapI", "CompareAndSwapL", "CompareAndSwapP", "CompareAndSwapN",
3512     "WeakCompareAndSwapB", "WeakCompareAndSwapS", "WeakCompareAndSwapI", "WeakCompareAndSwapL", "WeakCompareAndSwapP", "WeakCompareAndSwapN",
3513     "CompareAndExchangeB", "CompareAndExchangeS", "CompareAndExchangeI", "CompareAndExchangeL", "CompareAndExchangeP", "CompareAndExchangeN",
3514     "StoreCM",
3515     "ClearArray",
3516     "GetAndSetB", "GetAndSetS", "GetAndAddI", "GetAndSetI", "GetAndSetP",
3517     "GetAndAddB", "GetAndAddS", "GetAndAddL", "GetAndSetL", "GetAndSetN",

3518     "LoadBarrierSlowReg", "LoadBarrierWeakSlowReg"
3519   };
3520   int cnt = sizeof(needs_ideal_memory_list)/sizeof(char*);
3521   if( strcmp(_opType,"PrefetchAllocation")==0 )
3522     return 1;
3523   if( _lChild ) {
3524     const char *opType = _lChild->_opType;
3525     for( int i=0; i<cnt; i++ )
3526       if( strcmp(opType,needs_ideal_memory_list[i]) == 0 )
3527         return 1;
3528     if( _lChild->needs_ideal_memory_edge(globals) )
3529       return 1;
3530   }
3531   if( _rChild ) {
3532     const char *opType = _rChild->_opType;
3533     for( int i=0; i<cnt; i++ )
3534       if( strcmp(opType,needs_ideal_memory_list[i]) == 0 )
3535         return 1;
3536     if( _rChild->needs_ideal_memory_edge(globals) )
3537       return 1;


4102 }
4103 
4104 bool MatchRule::is_ideal_fastlock() const {
4105   if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
4106     return (strcmp(_rChild->_opType,"FastLock") == 0);
4107   }
4108   return false;
4109 }
4110 
4111 bool MatchRule::is_ideal_membar() const {
4112   if( !_opType ) return false;
4113   return
4114     !strcmp(_opType,"MemBarAcquire") ||
4115     !strcmp(_opType,"MemBarRelease") ||
4116     !strcmp(_opType,"MemBarAcquireLock") ||
4117     !strcmp(_opType,"MemBarReleaseLock") ||
4118     !strcmp(_opType,"LoadFence" ) ||
4119     !strcmp(_opType,"StoreFence") ||
4120     !strcmp(_opType,"MemBarVolatile") ||
4121     !strcmp(_opType,"MemBarCPUOrder") ||
4122     !strcmp(_opType,"MemBarStoreStore");

4123 }
4124 
4125 bool MatchRule::is_ideal_loadPC() const {
4126   if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
4127     return (strcmp(_rChild->_opType,"LoadPC") == 0);
4128   }
4129   return false;
4130 }
4131 
4132 bool MatchRule::is_ideal_box() const {
4133   if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
4134     return (strcmp(_rChild->_opType,"Box") == 0);
4135   }
4136   return false;
4137 }
4138 
4139 bool MatchRule::is_ideal_goto() const {
4140   bool   ideal_goto = false;
4141 
4142   if( _opType && (strcmp(_opType,"Goto") == 0) ) {




 624     if( !form ) continue;
 625     OpClassForm *op   = form->is_opclass();
 626     if( !op ) continue;
 627     if( form->interface_type(globals) == Form::memory_interface ) {
 628       if( comp->isa(Component::USE) ) USE_of_memory = true;
 629       if( comp->isa(Component::DEF) ) {
 630         OperandForm *oper = form->is_operand();
 631         if( oper && oper->is_user_name_for_sReg() ) {
 632           // Stack slots are unaliased memory handled by allocator
 633           oper = oper;  // debug stopping point !!!!!
 634         } else {
 635           DEF_of_memory = true;
 636         }
 637       }
 638     }
 639   }
 640   return (USE_of_memory && !DEF_of_memory);
 641 }
 642 
 643 
















 644 int InstructForm::memory_operand(FormDict &globals) const {
 645   // Machine independent loads must be checked for anti-dependences
 646   // Check if instruction has a USE of a memory operand class, or a def.
 647   int USE_of_memory  = 0;
 648   int DEF_of_memory  = 0;
 649   const char*    last_memory_DEF = NULL; // to test DEF/USE pairing in asserts
 650   const char*    last_memory_USE = NULL;
 651   Component     *unique          = NULL;
 652   Component     *comp            = NULL;
 653   ComponentList &components      = (ComponentList &)_components;
 654 
 655   components.reset();
 656   while( (comp = components.iter()) != NULL ) {
 657     const Form  *form = globals[comp->_type];
 658     if( !form ) continue;
 659     OpClassForm *op   = form->is_opclass();
 660     if( !op ) continue;
 661     if( op->stack_slots_only(globals) )  continue;
 662     if( form->interface_type(globals) == Form::memory_interface ) {
 663       if( comp->isa(Component::DEF) ) {


 757   return NO_MEMORY_OPERAND;
 758 }
 759 
 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 #if INCLUDE_SHENANDOAHGC
 778        !strcmp(_matrule->_rChild->_opType,"ShenandoahCompareAndExchangeP") ||
 779        !strcmp(_matrule->_rChild->_opType,"ShenandoahCompareAndExchangeN") ||
 780        !strcmp(_matrule->_rChild->_opType,"ShenandoahReadBarrier") ||
 781 #endif
 782        !strcmp(_matrule->_rChild->_opType,"CompareAndExchangeP") ||
 783        !strcmp(_matrule->_rChild->_opType,"CompareAndExchangeN"))) return true;
 784   else if ( is_ideal_load() == Form::idealP )                return true;
 785   else if ( is_ideal_store() != Form::none  )                return true;
 786 
 787   if (needs_base_oop_edge(globals)) return true;
 788 
 789   if (is_vector()) return true;
 790   if (is_mach_constant()) return true;
 791 
 792   return  false;
 793 }
 794 
 795 
 796 // Access instr_cost attribute or return NULL.
 797 const char* InstructForm::cost() {
 798   for (Attribute* cur = _attribs; cur != NULL; cur = (Attribute*)cur->_next) {
 799     if( strcmp(cur->_ident,AttributeForm::_ins_cost) == 0 ) {
 800       return cur->_val;
 801     }
 802   }
 803   return NULL;


1145     return "MachReturnNode";
1146   }
1147   else if (is_ideal_halt()) {
1148     return "MachHaltNode";
1149   }
1150   else if (is_ideal_safepoint()) {
1151     return "MachSafePointNode";
1152   }
1153   else if (is_ideal_if()) {
1154     return "MachIfNode";
1155   }
1156   else if (is_ideal_goto()) {
1157     return "MachGotoNode";
1158   }
1159   else if (is_ideal_fastlock()) {
1160     return "MachFastLockNode";
1161   }
1162   else if (is_ideal_nop()) {
1163     return "MachNopNode";
1164   }
1165   else if (is_ideal_membar()) {
1166     return "MachMemBarNode";
1167   }
1168   else if (is_ideal_jump()) {
1169     return "MachJumpNode";
1170   }
1171   else if (is_mach_constant()) {
1172     return "MachConstantNode";
1173   }
1174   else if (captures_bottom_type(globals)) {
1175     return "MachTypeNode";
1176   } else {
1177     return "MachNode";
1178   }
1179   assert( false, "ShouldNotReachHere()");
1180   return NULL;
1181 }
1182 
1183 // Compare the instruction predicates for textual equality
1184 bool equivalent_predicates( const InstructForm *instr1, const InstructForm *instr2 ) {
1185   const Predicate *pred1  = instr1->_predicate;
1186   const Predicate *pred2  = instr2->_predicate;
1187   if( pred1 == NULL && pred2 == NULL ) {


3490   }
3491 }
3492 
3493 int MatchNode::needs_ideal_memory_edge(FormDict &globals) const {
3494   static const char *needs_ideal_memory_list[] = {
3495     "StoreI","StoreL","StoreP","StoreN","StoreNKlass","StoreD","StoreF" ,
3496     "StoreB","StoreC","Store" ,"StoreFP",
3497     "LoadI", "LoadL", "LoadP" ,"LoadN", "LoadD" ,"LoadF"  ,
3498     "LoadB" , "LoadUB", "LoadUS" ,"LoadS" ,"Load" ,
3499     "StoreVector", "LoadVector",
3500     "LoadRange", "LoadKlass", "LoadNKlass", "LoadL_unaligned", "LoadD_unaligned",
3501     "LoadPLocked",
3502     "StorePConditional", "StoreIConditional", "StoreLConditional",
3503     "CompareAndSwapB", "CompareAndSwapS", "CompareAndSwapI", "CompareAndSwapL", "CompareAndSwapP", "CompareAndSwapN",
3504     "WeakCompareAndSwapB", "WeakCompareAndSwapS", "WeakCompareAndSwapI", "WeakCompareAndSwapL", "WeakCompareAndSwapP", "WeakCompareAndSwapN",
3505     "CompareAndExchangeB", "CompareAndExchangeS", "CompareAndExchangeI", "CompareAndExchangeL", "CompareAndExchangeP", "CompareAndExchangeN",
3506     "StoreCM",
3507     "ClearArray",
3508     "GetAndSetB", "GetAndSetS", "GetAndAddI", "GetAndSetI", "GetAndSetP",
3509     "GetAndAddB", "GetAndAddS", "GetAndAddL", "GetAndSetL", "GetAndSetN",
3510     "ShenandoahReadBarrier",
3511     "LoadBarrierSlowReg", "LoadBarrierWeakSlowReg"
3512   };
3513   int cnt = sizeof(needs_ideal_memory_list)/sizeof(char*);
3514   if( strcmp(_opType,"PrefetchAllocation")==0 )
3515     return 1;
3516   if( _lChild ) {
3517     const char *opType = _lChild->_opType;
3518     for( int i=0; i<cnt; i++ )
3519       if( strcmp(opType,needs_ideal_memory_list[i]) == 0 )
3520         return 1;
3521     if( _lChild->needs_ideal_memory_edge(globals) )
3522       return 1;
3523   }
3524   if( _rChild ) {
3525     const char *opType = _rChild->_opType;
3526     for( int i=0; i<cnt; i++ )
3527       if( strcmp(opType,needs_ideal_memory_list[i]) == 0 )
3528         return 1;
3529     if( _rChild->needs_ideal_memory_edge(globals) )
3530       return 1;


4095 }
4096 
4097 bool MatchRule::is_ideal_fastlock() const {
4098   if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
4099     return (strcmp(_rChild->_opType,"FastLock") == 0);
4100   }
4101   return false;
4102 }
4103 
4104 bool MatchRule::is_ideal_membar() const {
4105   if( !_opType ) return false;
4106   return
4107     !strcmp(_opType,"MemBarAcquire") ||
4108     !strcmp(_opType,"MemBarRelease") ||
4109     !strcmp(_opType,"MemBarAcquireLock") ||
4110     !strcmp(_opType,"MemBarReleaseLock") ||
4111     !strcmp(_opType,"LoadFence" ) ||
4112     !strcmp(_opType,"StoreFence") ||
4113     !strcmp(_opType,"MemBarVolatile") ||
4114     !strcmp(_opType,"MemBarCPUOrder") ||
4115     !strcmp(_opType,"MemBarStoreStore") ||
4116     !strcmp(_opType,"OnSpinWait");
4117 }
4118 
4119 bool MatchRule::is_ideal_loadPC() const {
4120   if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
4121     return (strcmp(_rChild->_opType,"LoadPC") == 0);
4122   }
4123   return false;
4124 }
4125 
4126 bool MatchRule::is_ideal_box() const {
4127   if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
4128     return (strcmp(_rChild->_opType,"Box") == 0);
4129   }
4130   return false;
4131 }
4132 
4133 bool MatchRule::is_ideal_goto() const {
4134   bool   ideal_goto = false;
4135 
4136   if( _opType && (strcmp(_opType,"Goto") == 0) ) {


< prev index next >