3902
3903
3904 bool MatchRule::is_base_register(FormDict &globals) const {
3905 uint position = 1;
3906 const char *result = NULL;
3907 const char *name = NULL;
3908 const char *opType = NULL;
3909 if (!base_operand(position, globals, result, name, opType)) {
3910 position = 0;
3911 if( base_operand(position, globals, result, name, opType) &&
3912 (strcmp(opType,"RegI")==0 ||
3913 strcmp(opType,"RegP")==0 ||
3914 strcmp(opType,"RegN")==0 ||
3915 strcmp(opType,"RegL")==0 ||
3916 strcmp(opType,"RegF")==0 ||
3917 strcmp(opType,"RegD")==0 ||
3918 strcmp(opType,"VecS")==0 ||
3919 strcmp(opType,"VecD")==0 ||
3920 strcmp(opType,"VecX")==0 ||
3921 strcmp(opType,"VecY")==0 ||
3922 strcmp(opType,"Reg" )==0) ) {
3923 return 1;
3924 }
3925 }
3926 return 0;
3927 }
3928
3929 Form::DataType MatchRule::is_base_constant(FormDict &globals) const {
3930 uint position = 1;
3931 const char *result = NULL;
3932 const char *name = NULL;
3933 const char *opType = NULL;
3934 if (!base_operand(position, globals, result, name, opType)) {
3935 position = 0;
3936 if (base_operand(position, globals, result, name, opType)) {
3937 return ideal_to_const_type(opType);
3938 }
3939 }
3940 return Form::none;
3941 }
4031 strcmp(opType,"EncodeP")==0 ||
4032 strcmp(opType,"EncodePKlass")==0 ||
4033 strcmp(opType,"DecodeNKlass")==0 ||
4034 strcmp(opType,"RoundDouble")==0 ||
4035 strcmp(opType,"RoundFloat")==0 ||
4036 strcmp(opType,"ReverseBytesI")==0 ||
4037 strcmp(opType,"ReverseBytesL")==0 ||
4038 strcmp(opType,"ReverseBytesUS")==0 ||
4039 strcmp(opType,"ReverseBytesS")==0 ||
4040 strcmp(opType,"ReplicateB")==0 ||
4041 strcmp(opType,"ReplicateS")==0 ||
4042 strcmp(opType,"ReplicateI")==0 ||
4043 strcmp(opType,"ReplicateL")==0 ||
4044 strcmp(opType,"ReplicateF")==0 ||
4045 strcmp(opType,"ReplicateD")==0 ||
4046 strcmp(opType,"AddReductionVI")==0 ||
4047 strcmp(opType,"AddReductionVL")==0 ||
4048 strcmp(opType,"AddReductionVF")==0 ||
4049 strcmp(opType,"AddReductionVD")==0 ||
4050 strcmp(opType,"MulReductionVI")==0 ||
4051 strcmp(opType,"MulReductionVF")==0 ||
4052 strcmp(opType,"MulReductionVD")==0 ||
4053 0 /* 0 to line up columns nicely */ )
4054 return 1;
4055 }
4056 return 0;
4057 }
4058
4059 bool MatchRule::is_ideal_if() const {
4060 if( !_opType ) return false;
4061 return
4062 !strcmp(_opType,"If" ) ||
4063 !strcmp(_opType,"CountedLoopEnd");
4064 }
4065
4066 bool MatchRule::is_ideal_fastlock() const {
4067 if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
4068 return (strcmp(_rChild->_opType,"FastLock") == 0);
4069 }
4070 return false;
4122 }
4123 return false;
4124 }
4125
4126
4127 Form::DataType MatchRule::is_ideal_load() const {
4128 Form::DataType ideal_load = Form::none;
4129
4130 if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
4131 const char *opType = _rChild->_opType;
4132 ideal_load = is_load_from_memory(opType);
4133 }
4134
4135 return ideal_load;
4136 }
4137
4138 bool MatchRule::is_vector() const {
4139 static const char *vector_list[] = {
4140 "AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
4141 "SubVB","SubVS","SubVI","SubVL","SubVF","SubVD",
4142 "MulVS","MulVI","MulVF","MulVD",
4143 "DivVF","DivVD",
4144 "AndV" ,"XorV" ,"OrV",
4145 "AddReductionVI", "AddReductionVL",
4146 "AddReductionVF", "AddReductionVD",
4147 "MulReductionVI",
4148 "MulReductionVF", "MulReductionVD",
4149 "LShiftCntV","RShiftCntV",
4150 "LShiftVB","LShiftVS","LShiftVI","LShiftVL",
4151 "RShiftVB","RShiftVS","RShiftVI","RShiftVL",
4152 "URShiftVB","URShiftVS","URShiftVI","URShiftVL",
4153 "ReplicateB","ReplicateS","ReplicateI","ReplicateL","ReplicateF","ReplicateD",
4154 "LoadVector","StoreVector",
4155 // Next are not supported currently.
4156 "PackB","PackS","PackI","PackL","PackF","PackD","Pack2L","Pack2D",
4157 "ExtractB","ExtractUB","ExtractC","ExtractS","ExtractI","ExtractL","ExtractF","ExtractD"
4158 };
4159 int cnt = sizeof(vector_list)/sizeof(char*);
4160 if (_rChild) {
4161 const char *opType = _rChild->_opType;
4162 for (int i=0; i<cnt; i++)
4163 if (strcmp(opType,vector_list[i]) == 0)
4164 return true;
4165 }
4166 return false;
4167 }
|
3902
3903
3904 bool MatchRule::is_base_register(FormDict &globals) const {
3905 uint position = 1;
3906 const char *result = NULL;
3907 const char *name = NULL;
3908 const char *opType = NULL;
3909 if (!base_operand(position, globals, result, name, opType)) {
3910 position = 0;
3911 if( base_operand(position, globals, result, name, opType) &&
3912 (strcmp(opType,"RegI")==0 ||
3913 strcmp(opType,"RegP")==0 ||
3914 strcmp(opType,"RegN")==0 ||
3915 strcmp(opType,"RegL")==0 ||
3916 strcmp(opType,"RegF")==0 ||
3917 strcmp(opType,"RegD")==0 ||
3918 strcmp(opType,"VecS")==0 ||
3919 strcmp(opType,"VecD")==0 ||
3920 strcmp(opType,"VecX")==0 ||
3921 strcmp(opType,"VecY")==0 ||
3922 strcmp(opType,"VecZ")==0 ||
3923 strcmp(opType,"Reg" )==0) ) {
3924 return 1;
3925 }
3926 }
3927 return 0;
3928 }
3929
3930 Form::DataType MatchRule::is_base_constant(FormDict &globals) const {
3931 uint position = 1;
3932 const char *result = NULL;
3933 const char *name = NULL;
3934 const char *opType = NULL;
3935 if (!base_operand(position, globals, result, name, opType)) {
3936 position = 0;
3937 if (base_operand(position, globals, result, name, opType)) {
3938 return ideal_to_const_type(opType);
3939 }
3940 }
3941 return Form::none;
3942 }
4032 strcmp(opType,"EncodeP")==0 ||
4033 strcmp(opType,"EncodePKlass")==0 ||
4034 strcmp(opType,"DecodeNKlass")==0 ||
4035 strcmp(opType,"RoundDouble")==0 ||
4036 strcmp(opType,"RoundFloat")==0 ||
4037 strcmp(opType,"ReverseBytesI")==0 ||
4038 strcmp(opType,"ReverseBytesL")==0 ||
4039 strcmp(opType,"ReverseBytesUS")==0 ||
4040 strcmp(opType,"ReverseBytesS")==0 ||
4041 strcmp(opType,"ReplicateB")==0 ||
4042 strcmp(opType,"ReplicateS")==0 ||
4043 strcmp(opType,"ReplicateI")==0 ||
4044 strcmp(opType,"ReplicateL")==0 ||
4045 strcmp(opType,"ReplicateF")==0 ||
4046 strcmp(opType,"ReplicateD")==0 ||
4047 strcmp(opType,"AddReductionVI")==0 ||
4048 strcmp(opType,"AddReductionVL")==0 ||
4049 strcmp(opType,"AddReductionVF")==0 ||
4050 strcmp(opType,"AddReductionVD")==0 ||
4051 strcmp(opType,"MulReductionVI")==0 ||
4052 strcmp(opType,"MulReductionVL")==0 ||
4053 strcmp(opType,"MulReductionVF")==0 ||
4054 strcmp(opType,"MulReductionVD")==0 ||
4055 0 /* 0 to line up columns nicely */ )
4056 return 1;
4057 }
4058 return 0;
4059 }
4060
4061 bool MatchRule::is_ideal_if() const {
4062 if( !_opType ) return false;
4063 return
4064 !strcmp(_opType,"If" ) ||
4065 !strcmp(_opType,"CountedLoopEnd");
4066 }
4067
4068 bool MatchRule::is_ideal_fastlock() const {
4069 if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
4070 return (strcmp(_rChild->_opType,"FastLock") == 0);
4071 }
4072 return false;
4124 }
4125 return false;
4126 }
4127
4128
4129 Form::DataType MatchRule::is_ideal_load() const {
4130 Form::DataType ideal_load = Form::none;
4131
4132 if ( _opType && (strcmp(_opType,"Set") == 0) && _rChild ) {
4133 const char *opType = _rChild->_opType;
4134 ideal_load = is_load_from_memory(opType);
4135 }
4136
4137 return ideal_load;
4138 }
4139
4140 bool MatchRule::is_vector() const {
4141 static const char *vector_list[] = {
4142 "AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
4143 "SubVB","SubVS","SubVI","SubVL","SubVF","SubVD",
4144 "MulVS","MulVI","MulVL","MulVF","MulVD",
4145 "DivVF","DivVD",
4146 "AndV" ,"XorV" ,"OrV",
4147 "AddReductionVI", "AddReductionVL",
4148 "AddReductionVF", "AddReductionVD",
4149 "MulReductionVI", "MulReductionVL",
4150 "MulReductionVF", "MulReductionVD",
4151 "LShiftCntV","RShiftCntV",
4152 "LShiftVB","LShiftVS","LShiftVI","LShiftVL",
4153 "RShiftVB","RShiftVS","RShiftVI","RShiftVL",
4154 "URShiftVB","URShiftVS","URShiftVI","URShiftVL",
4155 "ReplicateB","ReplicateS","ReplicateI","ReplicateL","ReplicateF","ReplicateD",
4156 "LoadVector","StoreVector",
4157 // Next are not supported currently.
4158 "PackB","PackS","PackI","PackL","PackF","PackD","Pack2L","Pack2D",
4159 "ExtractB","ExtractUB","ExtractC","ExtractS","ExtractI","ExtractL","ExtractF","ExtractD"
4160 };
4161 int cnt = sizeof(vector_list)/sizeof(char*);
4162 if (_rChild) {
4163 const char *opType = _rChild->_opType;
4164 for (int i=0; i<cnt; i++)
4165 if (strcmp(opType,vector_list[i]) == 0)
4166 return true;
4167 }
4168 return false;
4169 }
|