< prev index next >

src/share/vm/adlc/formssel.cpp

Print this page




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


1143     return "MachReturnNode";
1144   }
1145   else if (is_ideal_halt()) {
1146     return "MachHaltNode";
1147   }
1148   else if (is_ideal_safepoint()) {
1149     return "MachSafePointNode";
1150   }
1151   else if (is_ideal_if()) {
1152     return "MachIfNode";
1153   }
1154   else if (is_ideal_goto()) {
1155     return "MachGotoNode";
1156   }
1157   else if (is_ideal_fastlock()) {
1158     return "MachFastLockNode";
1159   }
1160   else if (is_ideal_nop()) {
1161     return "MachNopNode";
1162   }



1163   else if (is_mach_constant()) {
1164     return "MachConstantNode";
1165   }
1166   else if (captures_bottom_type(globals)) {
1167     return "MachTypeNode";
1168   } else {
1169     return "MachNode";
1170   }
1171   assert( false, "ShouldNotReachHere()");
1172   return NULL;
1173 }
1174 
1175 // Compare the instruction predicates for textual equality
1176 bool equivalent_predicates( const InstructForm *instr1, const InstructForm *instr2 ) {
1177   const Predicate *pred1  = instr1->_predicate;
1178   const Predicate *pred2  = instr2->_predicate;
1179   if( pred1 == NULL && pred2 == NULL ) {
1180     // no predicates means they are identical
1181     return true;
1182   }


3470   }
3471   else {
3472     fprintf(fp," (%s ",_name);  // " (opcodeName "
3473     if(_lChild) _lChild->output(fp); //               left operand
3474     if(_rChild) _rChild->output(fp); //                    right operand
3475     fprintf(fp,")");                 //                                 ")"
3476   }
3477 }
3478 
3479 int MatchNode::needs_ideal_memory_edge(FormDict &globals) const {
3480   static const char *needs_ideal_memory_list[] = {
3481     "StoreI","StoreL","StoreP","StoreN","StoreNKlass","StoreD","StoreF" ,
3482     "StoreB","StoreC","Store" ,"StoreFP",
3483     "LoadI", "LoadL", "LoadP" ,"LoadN", "LoadD" ,"LoadF"  ,
3484     "LoadB" , "LoadUB", "LoadUS" ,"LoadS" ,"Load" ,
3485     "StoreVector", "LoadVector",
3486     "LoadRange", "LoadKlass", "LoadNKlass", "LoadL_unaligned", "LoadD_unaligned",
3487     "LoadPLocked",
3488     "StorePConditional", "StoreIConditional", "StoreLConditional",
3489     "CompareAndSwapI", "CompareAndSwapL", "CompareAndSwapP", "CompareAndSwapN",

3490     "StoreCM",
3491     "ClearArray",
3492     "GetAndAddI", "GetAndSetI", "GetAndSetP",
3493     "GetAndAddL", "GetAndSetL", "GetAndSetN",
3494   };
3495   int cnt = sizeof(needs_ideal_memory_list)/sizeof(char*);
3496   if( strcmp(_opType,"PrefetchRead")==0 ||
3497       strcmp(_opType,"PrefetchWrite")==0 ||
3498       strcmp(_opType,"PrefetchAllocation")==0 )
3499     return 1;
3500   if( _lChild ) {
3501     const char *opType = _lChild->_opType;
3502     for( int i=0; i<cnt; i++ )
3503       if( strcmp(opType,needs_ideal_memory_list[i]) == 0 )
3504         return 1;
3505     if( _lChild->needs_ideal_memory_edge(globals) )
3506       return 1;
3507   }
3508   if( _rChild ) {
3509     const char *opType = _rChild->_opType;




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
















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


1127     return "MachReturnNode";
1128   }
1129   else if (is_ideal_halt()) {
1130     return "MachHaltNode";
1131   }
1132   else if (is_ideal_safepoint()) {
1133     return "MachSafePointNode";
1134   }
1135   else if (is_ideal_if()) {
1136     return "MachIfNode";
1137   }
1138   else if (is_ideal_goto()) {
1139     return "MachGotoNode";
1140   }
1141   else if (is_ideal_fastlock()) {
1142     return "MachFastLockNode";
1143   }
1144   else if (is_ideal_nop()) {
1145     return "MachNopNode";
1146   }
1147   else if (is_ideal_membar()) {
1148     return "MachMemBarNode";
1149   }
1150   else if (is_mach_constant()) {
1151     return "MachConstantNode";
1152   }
1153   else if (captures_bottom_type(globals)) {
1154     return "MachTypeNode";
1155   } else {
1156     return "MachNode";
1157   }
1158   assert( false, "ShouldNotReachHere()");
1159   return NULL;
1160 }
1161 
1162 // Compare the instruction predicates for textual equality
1163 bool equivalent_predicates( const InstructForm *instr1, const InstructForm *instr2 ) {
1164   const Predicate *pred1  = instr1->_predicate;
1165   const Predicate *pred2  = instr2->_predicate;
1166   if( pred1 == NULL && pred2 == NULL ) {
1167     // no predicates means they are identical
1168     return true;
1169   }


3457   }
3458   else {
3459     fprintf(fp," (%s ",_name);  // " (opcodeName "
3460     if(_lChild) _lChild->output(fp); //               left operand
3461     if(_rChild) _rChild->output(fp); //                    right operand
3462     fprintf(fp,")");                 //                                 ")"
3463   }
3464 }
3465 
3466 int MatchNode::needs_ideal_memory_edge(FormDict &globals) const {
3467   static const char *needs_ideal_memory_list[] = {
3468     "StoreI","StoreL","StoreP","StoreN","StoreNKlass","StoreD","StoreF" ,
3469     "StoreB","StoreC","Store" ,"StoreFP",
3470     "LoadI", "LoadL", "LoadP" ,"LoadN", "LoadD" ,"LoadF"  ,
3471     "LoadB" , "LoadUB", "LoadUS" ,"LoadS" ,"Load" ,
3472     "StoreVector", "LoadVector",
3473     "LoadRange", "LoadKlass", "LoadNKlass", "LoadL_unaligned", "LoadD_unaligned",
3474     "LoadPLocked",
3475     "StorePConditional", "StoreIConditional", "StoreLConditional",
3476     "CompareAndSwapI", "CompareAndSwapL", "CompareAndSwapP", "CompareAndSwapN",
3477     "ShenandoahCompareAndSwapN", "ShenandoahCompareAndSwapP",
3478     "StoreCM",
3479     "ClearArray",
3480     "GetAndAddI", "GetAndSetI", "GetAndSetP",
3481     "GetAndAddL", "GetAndSetL", "GetAndSetN",
3482   };
3483   int cnt = sizeof(needs_ideal_memory_list)/sizeof(char*);
3484   if( strcmp(_opType,"PrefetchRead")==0 ||
3485       strcmp(_opType,"PrefetchWrite")==0 ||
3486       strcmp(_opType,"PrefetchAllocation")==0 )
3487     return 1;
3488   if( _lChild ) {
3489     const char *opType = _lChild->_opType;
3490     for( int i=0; i<cnt; i++ )
3491       if( strcmp(opType,needs_ideal_memory_list[i]) == 0 )
3492         return 1;
3493     if( _lChild->needs_ideal_memory_edge(globals) )
3494       return 1;
3495   }
3496   if( _rChild ) {
3497     const char *opType = _rChild->_opType;


< prev index next >