1179 !is_short_branch() && // Don't match another short branch variant |
1179 !is_short_branch() && // Don't match another short branch variant |
1180 reduce_result() != NULL && |
1180 reduce_result() != NULL && |
1181 strcmp(reduce_result(), short_branch->reduce_result()) == 0 && |
1181 strcmp(reduce_result(), short_branch->reduce_result()) == 0 && |
1182 _matrule->equivalent(AD.globalNames(), short_branch->_matrule)) { |
1182 _matrule->equivalent(AD.globalNames(), short_branch->_matrule)) { |
1183 // The instructions are equivalent. |
1183 // The instructions are equivalent. |
|
1184 |
|
1185 // Now verify that both instructions have the same parameters and |
|
1186 // the same effects. Both branch forms should have the same inputs |
|
1187 // and resulting projections to correctly replace a long branch node |
|
1188 // with corresponding short branch node during code generation. |
|
1189 |
|
1190 bool different = false; |
|
1191 if (short_branch->_components.count() != _components.count()) { |
|
1192 different = true; |
|
1193 } else if (_components.count() > 0) { |
|
1194 short_branch->_components.reset(); |
|
1195 _components.reset(); |
|
1196 Component *comp; |
|
1197 while ((comp = _components.iter()) != NULL) { |
|
1198 Component *short_comp = short_branch->_components.iter(); |
|
1199 if (short_comp == NULL || |
|
1200 short_comp->_type != comp->_type || |
|
1201 short_comp->_usedef != comp->_usedef) { |
|
1202 different = true; |
|
1203 break; |
|
1204 } |
|
1205 } |
|
1206 if (short_branch->_components.iter() != NULL) |
|
1207 different = true; |
|
1208 } |
|
1209 if (different) { |
|
1210 globalAD->syntax_err(short_branch->_linenum, "Instruction %s and its short form %s have different parameters\n", _ident, short_branch->_ident); |
|
1211 } |
1184 if (AD._short_branch_debug) { |
1212 if (AD._short_branch_debug) { |
1185 fprintf(stderr, "Instruction %s has short form %s\n", _ident, short_branch->_ident); |
1213 fprintf(stderr, "Instruction %s has short form %s\n", _ident, short_branch->_ident); |
1186 } |
1214 } |
1187 _short_branch_form = short_branch; |
1215 _short_branch_form = short_branch; |
1188 return true; |
1216 return true; |