< prev index next >

src/hotspot/share/adlc/formssel.cpp

Print this page




 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_ZGC
 778        !strcmp(_matrule->_rChild->_opType,"LoadBarrierSlowReg") ||
 779        !strcmp(_matrule->_rChild->_opType,"LoadBarrierWeakSlowReg") ||
 780 #endif
 781 #if INCLUDE_SHENANDOAHGC
 782        !strcmp(_matrule->_rChild->_opType,"ShenandoahCompareAndExchangeP") ||
 783        !strcmp(_matrule->_rChild->_opType,"ShenandoahCompareAndExchangeN") ||
 784 #endif
 785        !strcmp(_matrule->_rChild->_opType,"CompareAndExchangeP") ||
 786        !strcmp(_matrule->_rChild->_opType,"CompareAndExchangeN"))) return true;


 787   else if ( is_ideal_load() == Form::idealP )                return true;
 788   else if ( is_ideal_store() != Form::none  )                return true;
 789 
 790   if (needs_base_oop_edge(globals)) return true;
 791 
 792   if (is_vector()) return true;
 793   if (is_mach_constant()) return true;
 794 
 795   return  false;
 796 }
 797 
 798 
 799 // Access instr_cost attribute or return NULL.
 800 const char* InstructForm::cost() {
 801   for (Attribute* cur = _attribs; cur != NULL; cur = (Attribute*)cur->_next) {
 802     if( strcmp(cur->_ident,AttributeForm::_ins_cost) == 0 ) {
 803       return cur->_val;
 804     }
 805   }
 806   return NULL;


3791   } else if (mNode2->_rChild) {
3792     return false; // I have NULL right child, mNode2 has non-NULL right child.
3793   }
3794 
3795   // We've made it through the gauntlet.
3796   return true;
3797 }
3798 
3799 //-------------------------- has_commutative_op -------------------------------
3800 // Recursively check for commutative operations with subtree operands
3801 // which could be swapped.
3802 void MatchNode::count_commutative_op(int& count) {
3803   static const char *commut_op_list[] = {
3804     "AddI","AddL","AddF","AddD",
3805     "AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
3806     "AndI","AndL",
3807     "AndV",
3808     "MaxI","MinI","MaxF","MinF","MaxD","MinD",
3809     "MaxV", "MinV",
3810     "MulI","MulL","MulF","MulD",
3811     "MulVB","MulVS","MulVI","MulVL","MulVF","MulVD",
3812     "OrI","OrL",
3813     "OrV",
3814     "XorI","XorL",
3815     "XorV"
3816   };
3817   int cnt = sizeof(commut_op_list)/sizeof(char*);
3818 
3819   if( _lChild && _rChild && (_lChild->_lChild || _rChild->_lChild) ) {
3820     // Don't swap if right operand is an immediate constant.
3821     bool is_const = false;
3822     if( _rChild->_lChild == NULL && _rChild->_rChild == NULL ) {
3823       FormDict &globals = _AD.globalNames();
3824       const Form *form = globals[_rChild->_opType];
3825       if ( form ) {
3826         OperandForm  *oper = form->is_operand();
3827         if( oper && oper->interface_type(globals) == Form::constant_interface )
3828           is_const = true;
3829       }
3830     }
3831     if( !is_const ) {


4158   }
4159   return false;
4160 }
4161 
4162 
4163 Form::DataType MatchRule::is_ideal_load() const {
4164   Form::DataType ideal_load = Form::none;
4165 
4166   if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
4167     const char *opType = _rChild->_opType;
4168     ideal_load = is_load_from_memory(opType);
4169   }
4170 
4171   return ideal_load;
4172 }
4173 
4174 bool MatchRule::is_vector() const {
4175   static const char *vector_list[] = {
4176     "AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
4177     "SubVB","SubVS","SubVI","SubVL","SubVF","SubVD",
4178     "MulVB","MulVS","MulVI","MulVL","MulVF","MulVD",
4179     "CMoveVD", "CMoveVF",
4180     "DivVF","DivVD",
4181     "AbsVB","AbsVS","AbsVI","AbsVL","AbsVF","AbsVD",
4182     "NegVF","NegVD",
4183     "SqrtVD","SqrtVF",
4184     "AndV" ,"XorV" ,"OrV",
4185     "MaxV", "MinV",
4186     "AddReductionVI", "AddReductionVL",
4187     "AddReductionVF", "AddReductionVD",
4188     "MulReductionVI", "MulReductionVL",
4189     "MulReductionVF", "MulReductionVD",
4190     "MulAddVS2VI",
4191     "LShiftCntV","RShiftCntV",
4192     "LShiftVB","LShiftVS","LShiftVI","LShiftVL",
4193     "RShiftVB","RShiftVS","RShiftVI","RShiftVL",
4194     "URShiftVB","URShiftVS","URShiftVI","URShiftVL",
4195     "MaxReductionV", "MinReductionV",
4196     "ReplicateB","ReplicateS","ReplicateI","ReplicateL","ReplicateF","ReplicateD",
4197     "LoadVector","StoreVector",
4198     "FmaVD", "FmaVF","PopCountVI",
4199     // Next are not supported currently.
4200     "PackB","PackS","PackI","PackL","PackF","PackD","Pack2L","Pack2D",
4201     "ExtractB","ExtractUB","ExtractC","ExtractS","ExtractI","ExtractL","ExtractF","ExtractD"




 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        !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;


3785   } else if (mNode2->_rChild) {
3786     return false; // I have NULL right child, mNode2 has non-NULL right child.
3787   }
3788 
3789   // We've made it through the gauntlet.
3790   return true;
3791 }
3792 
3793 //-------------------------- has_commutative_op -------------------------------
3794 // Recursively check for commutative operations with subtree operands
3795 // which could be swapped.
3796 void MatchNode::count_commutative_op(int& count) {
3797   static const char *commut_op_list[] = {
3798     "AddI","AddL","AddF","AddD",
3799     "AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
3800     "AndI","AndL",
3801     "AndV",
3802     "MaxI","MinI","MaxF","MinF","MaxD","MinD",
3803     "MaxV", "MinV",
3804     "MulI","MulL","MulF","MulD",
3805     "MulVS","MulVI","MulVL","MulVF","MulVD",
3806     "OrI","OrL",
3807     "OrV",
3808     "XorI","XorL",
3809     "XorV"
3810   };
3811   int cnt = sizeof(commut_op_list)/sizeof(char*);
3812 
3813   if( _lChild && _rChild && (_lChild->_lChild || _rChild->_lChild) ) {
3814     // Don't swap if right operand is an immediate constant.
3815     bool is_const = false;
3816     if( _rChild->_lChild == NULL && _rChild->_rChild == NULL ) {
3817       FormDict &globals = _AD.globalNames();
3818       const Form *form = globals[_rChild->_opType];
3819       if ( form ) {
3820         OperandForm  *oper = form->is_operand();
3821         if( oper && oper->interface_type(globals) == Form::constant_interface )
3822           is_const = true;
3823       }
3824     }
3825     if( !is_const ) {


4152   }
4153   return false;
4154 }
4155 
4156 
4157 Form::DataType MatchRule::is_ideal_load() const {
4158   Form::DataType ideal_load = Form::none;
4159 
4160   if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
4161     const char *opType = _rChild->_opType;
4162     ideal_load = is_load_from_memory(opType);
4163   }
4164 
4165   return ideal_load;
4166 }
4167 
4168 bool MatchRule::is_vector() const {
4169   static const char *vector_list[] = {
4170     "AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
4171     "SubVB","SubVS","SubVI","SubVL","SubVF","SubVD",
4172     "MulVS","MulVI","MulVL","MulVF","MulVD",
4173     "CMoveVD", "CMoveVF",
4174     "DivVF","DivVD",
4175     "AbsVF","AbsVD",
4176     "NegVF","NegVD",
4177     "SqrtVD","SqrtVF",
4178     "AndV" ,"XorV" ,"OrV",
4179     "MaxV", "MinV",
4180     "AddReductionVI", "AddReductionVL",
4181     "AddReductionVF", "AddReductionVD",
4182     "MulReductionVI", "MulReductionVL",
4183     "MulReductionVF", "MulReductionVD",
4184     "MulAddVS2VI",
4185     "LShiftCntV","RShiftCntV",
4186     "LShiftVB","LShiftVS","LShiftVI","LShiftVL",
4187     "RShiftVB","RShiftVS","RShiftVI","RShiftVL",
4188     "URShiftVB","URShiftVS","URShiftVI","URShiftVL",
4189     "MaxReductionV", "MinReductionV",
4190     "ReplicateB","ReplicateS","ReplicateI","ReplicateL","ReplicateF","ReplicateD",
4191     "LoadVector","StoreVector",
4192     "FmaVD", "FmaVF","PopCountVI",
4193     // Next are not supported currently.
4194     "PackB","PackS","PackI","PackL","PackF","PackD","Pack2L","Pack2D",
4195     "ExtractB","ExtractUB","ExtractC","ExtractS","ExtractI","ExtractL","ExtractF","ExtractD"


< prev index next >