Mercurial > hg > graal-compiler
comparison src/share/vm/adlc/formssel.cpp @ 10389:f15fe46d8c00
8015266: fix some -Wsign-compare warnings in adlc
Reviewed-by: kvn
author | twisti |
---|---|
date | Thu, 30 May 2013 08:37:08 -0700 |
parents | 706c919d3b56 |
children | 7fa25f5575c9 |
comparison
equal
deleted
inserted
replaced
10388:320b4e0f0892 | 10389:f15fe46d8c00 |
---|---|
794 } | 794 } |
795 */ | 795 */ |
796 return num_opnds; | 796 return num_opnds; |
797 } | 797 } |
798 | 798 |
799 const char *InstructForm::opnd_ident(int idx) { | 799 const char* InstructForm::opnd_ident(int idx) { |
800 return _components.at(idx)->_name; | 800 return _components.at(idx)->_name; |
801 } | 801 } |
802 | 802 |
803 const char *InstructForm::unique_opnd_ident(int idx) { | 803 const char* InstructForm::unique_opnd_ident(uint idx) { |
804 uint i; | 804 uint i; |
805 for (i = 1; i < num_opnds(); ++i) { | 805 for (i = 1; i < num_opnds(); ++i) { |
806 if (unique_opnds_idx(i) == idx) { | 806 if (unique_opnds_idx(i) == idx) { |
807 break; | 807 break; |
808 } | 808 } |
1313 } | 1313 } |
1314 | 1314 |
1315 // Seach through operands to determine parameters unique positions. | 1315 // Seach through operands to determine parameters unique positions. |
1316 void InstructForm::set_unique_opnds() { | 1316 void InstructForm::set_unique_opnds() { |
1317 uint* uniq_idx = NULL; | 1317 uint* uniq_idx = NULL; |
1318 int nopnds = num_opnds(); | 1318 uint nopnds = num_opnds(); |
1319 uint num_uniq = nopnds; | 1319 uint num_uniq = nopnds; |
1320 int i; | 1320 uint i; |
1321 _uniq_idx_length = 0; | 1321 _uniq_idx_length = 0; |
1322 if ( nopnds > 0 ) { | 1322 if (nopnds > 0) { |
1323 // Allocate index array. Worst case we're mapping from each | 1323 // Allocate index array. Worst case we're mapping from each |
1324 // component back to an index and any DEF always goes at 0 so the | 1324 // component back to an index and any DEF always goes at 0 so the |
1325 // length of the array has to be the number of components + 1. | 1325 // length of the array has to be the number of components + 1. |
1326 _uniq_idx_length = _components.count() + 1; | 1326 _uniq_idx_length = _components.count() + 1; |
1327 uniq_idx = (uint*) malloc(sizeof(uint)*(_uniq_idx_length)); | 1327 uniq_idx = (uint*) malloc(sizeof(uint) * _uniq_idx_length); |
1328 for( i = 0; i < _uniq_idx_length; i++ ) { | 1328 for (i = 0; i < _uniq_idx_length; i++) { |
1329 uniq_idx[i] = i; | 1329 uniq_idx[i] = i; |
1330 } | 1330 } |
1331 } | 1331 } |
1332 // Do it only if there is a match rule and no expand rule. With an | 1332 // Do it only if there is a match rule and no expand rule. With an |
1333 // expand rule it is done by creating new mach node in Expand() | 1333 // expand rule it is done by creating new mach node in Expand() |
1334 // method. | 1334 // method. |
1335 if ( nopnds > 0 && _matrule != NULL && _exprule == NULL ) { | 1335 if (nopnds > 0 && _matrule != NULL && _exprule == NULL) { |
1336 const char *name; | 1336 const char *name; |
1337 uint count; | 1337 uint count; |
1338 bool has_dupl_use = false; | 1338 bool has_dupl_use = false; |
1339 | 1339 |
1340 _parameters.reset(); | 1340 _parameters.reset(); |
1341 while( (name = _parameters.iter()) != NULL ) { | 1341 while ((name = _parameters.iter()) != NULL) { |
1342 count = 0; | 1342 count = 0; |
1343 int position = 0; | 1343 uint position = 0; |
1344 int uniq_position = 0; | 1344 uint uniq_position = 0; |
1345 _components.reset(); | 1345 _components.reset(); |
1346 Component *comp = NULL; | 1346 Component *comp = NULL; |
1347 if( sets_result() ) { | 1347 if (sets_result()) { |
1348 comp = _components.iter(); | 1348 comp = _components.iter(); |
1349 position++; | 1349 position++; |
1350 } | 1350 } |
1351 // The next code is copied from the method operand_position(). | 1351 // The next code is copied from the method operand_position(). |
1352 for (; (comp = _components.iter()) != NULL; ++position) { | 1352 for (; (comp = _components.iter()) != NULL; ++position) { |
1353 // When the first component is not a DEF, | 1353 // When the first component is not a DEF, |
1354 // leave space for the result operand! | 1354 // leave space for the result operand! |
1355 if ( position==0 && (! comp->isa(Component::DEF)) ) { | 1355 if (position==0 && (!comp->isa(Component::DEF))) { |
1356 ++position; | 1356 ++position; |
1357 } | 1357 } |
1358 if( strcmp(name, comp->_name)==0 ) { | 1358 if (strcmp(name, comp->_name) == 0) { |
1359 if( ++count > 1 ) { | 1359 if (++count > 1) { |
1360 assert(position < _uniq_idx_length, "out of bounds"); | 1360 assert(position < _uniq_idx_length, "out of bounds"); |
1361 uniq_idx[position] = uniq_position; | 1361 uniq_idx[position] = uniq_position; |
1362 has_dupl_use = true; | 1362 has_dupl_use = true; |
1363 } else { | 1363 } else { |
1364 uniq_position = position; | 1364 uniq_position = position; |
1365 } | 1365 } |
1366 } | 1366 } |
1367 if( comp->isa(Component::DEF) | 1367 if (comp->isa(Component::DEF) && comp->isa(Component::USE)) { |
1368 && comp->isa(Component::USE) ) { | |
1369 ++position; | 1368 ++position; |
1370 if( position != 1 ) | 1369 if (position != 1) |
1371 --position; // only use two slots for the 1st USE_DEF | 1370 --position; // only use two slots for the 1st USE_DEF |
1372 } | 1371 } |
1373 } | 1372 } |
1374 } | 1373 } |
1375 if( has_dupl_use ) { | 1374 if (has_dupl_use) { |
1376 for( i = 1; i < nopnds; i++ ) | 1375 for (i = 1; i < nopnds; i++) { |
1377 if( i != uniq_idx[i] ) | 1376 if (i != uniq_idx[i]) { |
1378 break; | 1377 break; |
1379 int j = i; | 1378 } |
1380 for( ; i < nopnds; i++ ) | 1379 } |
1381 if( i == uniq_idx[i] ) | 1380 uint j = i; |
1381 for (; i < nopnds; i++) { | |
1382 if (i == uniq_idx[i]) { | |
1382 uniq_idx[i] = j++; | 1383 uniq_idx[i] = j++; |
1384 } | |
1385 } | |
1383 num_uniq = j; | 1386 num_uniq = j; |
1384 } | 1387 } |
1385 } | 1388 } |
1386 _uniq_idx = uniq_idx; | 1389 _uniq_idx = uniq_idx; |
1387 _num_uniq = num_uniq; | 1390 _num_uniq = num_uniq; |
2214 return globalAD->get_registers()->getRegClass(constrained_reg_class()); | 2217 return globalAD->get_registers()->getRegClass(constrained_reg_class()); |
2215 } | 2218 } |
2216 | 2219 |
2217 | 2220 |
2218 bool OperandForm::is_bound_register() const { | 2221 bool OperandForm::is_bound_register() const { |
2219 RegClass *reg_class = get_RegClass(); | 2222 RegClass* reg_class = get_RegClass(); |
2220 if (reg_class == NULL) return false; | 2223 if (reg_class == NULL) { |
2221 | 2224 return false; |
2222 const char * name = ideal_type(globalAD->globalNames()); | 2225 } |
2223 if (name == NULL) return false; | 2226 |
2224 | 2227 const char* name = ideal_type(globalAD->globalNames()); |
2225 int size = 0; | 2228 if (name == NULL) { |
2226 if (strcmp(name,"RegFlags")==0) size = 1; | 2229 return false; |
2227 if (strcmp(name,"RegI")==0) size = 1; | 2230 } |
2228 if (strcmp(name,"RegF")==0) size = 1; | 2231 |
2229 if (strcmp(name,"RegD")==0) size = 2; | 2232 uint size = 0; |
2230 if (strcmp(name,"RegL")==0) size = 2; | 2233 if (strcmp(name, "RegFlags") == 0) size = 1; |
2231 if (strcmp(name,"RegN")==0) size = 1; | 2234 if (strcmp(name, "RegI") == 0) size = 1; |
2232 if (strcmp(name,"RegP")==0) size = globalAD->get_preproc_def("_LP64") ? 2 : 1; | 2235 if (strcmp(name, "RegF") == 0) size = 1; |
2233 if (size == 0) return false; | 2236 if (strcmp(name, "RegD") == 0) size = 2; |
2237 if (strcmp(name, "RegL") == 0) size = 2; | |
2238 if (strcmp(name, "RegN") == 0) size = 1; | |
2239 if (strcmp(name, "RegP") == 0) size = globalAD->get_preproc_def("_LP64") ? 2 : 1; | |
2240 if (size == 0) { | |
2241 return false; | |
2242 } | |
2234 return size == reg_class->size(); | 2243 return size == reg_class->size(); |
2235 } | 2244 } |
2236 | 2245 |
2237 | 2246 |
2238 // Check if this is a valid field for this operand, | 2247 // Check if this is a valid field for this operand, |