1117 void *fill_candidate_datatypes_c::visit(SUB_operator_c *symbol) {return handle_binary_operator(widen_SUB_table, symbol, prev_il_instruction, il_operand);} |
1117 void *fill_candidate_datatypes_c::visit(SUB_operator_c *symbol) {return handle_binary_operator(widen_SUB_table, symbol, prev_il_instruction, il_operand);} |
1118 void *fill_candidate_datatypes_c::visit(MUL_operator_c *symbol) {return handle_binary_operator(widen_MUL_table, symbol, prev_il_instruction, il_operand);} |
1118 void *fill_candidate_datatypes_c::visit(MUL_operator_c *symbol) {return handle_binary_operator(widen_MUL_table, symbol, prev_il_instruction, il_operand);} |
1119 void *fill_candidate_datatypes_c::visit(DIV_operator_c *symbol) {return handle_binary_operator(widen_DIV_table, symbol, prev_il_instruction, il_operand);} |
1119 void *fill_candidate_datatypes_c::visit(DIV_operator_c *symbol) {return handle_binary_operator(widen_DIV_table, symbol, prev_il_instruction, il_operand);} |
1120 void *fill_candidate_datatypes_c::visit(MOD_operator_c *symbol) {return handle_binary_operator(widen_MOD_table, symbol, prev_il_instruction, il_operand);} |
1120 void *fill_candidate_datatypes_c::visit(MOD_operator_c *symbol) {return handle_binary_operator(widen_MOD_table, symbol, prev_il_instruction, il_operand);} |
1121 |
1121 |
1122 |
1122 void *fill_candidate_datatypes_c::visit( GT_operator_c *symbol) {return handle_binary_operator(widen_CMP_table, symbol, prev_il_instruction, il_operand);} |
1123 |
1123 void *fill_candidate_datatypes_c::visit( GE_operator_c *symbol) {return handle_binary_operator(widen_CMP_table, symbol, prev_il_instruction, il_operand);} |
1124 void *fill_candidate_datatypes_c::visit(GT_operator_c *symbol) { |
1124 void *fill_candidate_datatypes_c::visit( EQ_operator_c *symbol) {return handle_binary_operator(widen_CMP_table, symbol, prev_il_instruction, il_operand);} |
1125 bool found = false; |
1125 void *fill_candidate_datatypes_c::visit( LT_operator_c *symbol) {return handle_binary_operator(widen_CMP_table, symbol, prev_il_instruction, il_operand);} |
1126 |
1126 void *fill_candidate_datatypes_c::visit( LE_operator_c *symbol) {return handle_binary_operator(widen_CMP_table, symbol, prev_il_instruction, il_operand);} |
1127 if (NULL == prev_il_instruction) return NULL; |
1127 void *fill_candidate_datatypes_c::visit( NE_operator_c *symbol) {return handle_binary_operator(widen_CMP_table, symbol, prev_il_instruction, il_operand);} |
1128 for(unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { |
1128 |
1129 for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) { |
1129 |
1130 if (is_type_equal(prev_il_instruction->candidate_datatypes[i], il_operand->candidate_datatypes[j]) |
|
1131 && is_ANY_ELEMENTARY_compatible(prev_il_instruction->candidate_datatypes[i])) { |
|
1132 found = true; |
|
1133 break; |
|
1134 } |
|
1135 } |
|
1136 } |
|
1137 if (found) add_datatype_to_candidate_list(symbol, &search_constant_type_c::bool_type_name); |
|
1138 return NULL; |
|
1139 } |
|
1140 |
|
1141 void *fill_candidate_datatypes_c::visit(GE_operator_c *symbol) { |
|
1142 bool found = false; |
|
1143 |
|
1144 if (NULL == prev_il_instruction) return NULL; |
|
1145 for(unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { |
|
1146 for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) { |
|
1147 if (is_type_equal(prev_il_instruction->candidate_datatypes[i], il_operand->candidate_datatypes[j]) |
|
1148 && is_ANY_ELEMENTARY_compatible(prev_il_instruction->candidate_datatypes[i])) { |
|
1149 found = true; |
|
1150 break; |
|
1151 } |
|
1152 } |
|
1153 } |
|
1154 if (found) add_datatype_to_candidate_list(symbol, &search_constant_type_c::bool_type_name); |
|
1155 return NULL; |
|
1156 } |
|
1157 |
|
1158 void *fill_candidate_datatypes_c::visit(EQ_operator_c *symbol) { |
|
1159 bool found = false; |
|
1160 |
|
1161 if (NULL == prev_il_instruction) return NULL; |
|
1162 for(unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { |
|
1163 for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) { |
|
1164 if (is_type_equal(prev_il_instruction->candidate_datatypes[i], il_operand->candidate_datatypes[j]) |
|
1165 && is_ANY_ELEMENTARY_compatible(prev_il_instruction->candidate_datatypes[i])) { |
|
1166 found = true; |
|
1167 break; |
|
1168 } |
|
1169 } |
|
1170 } |
|
1171 if (found) add_datatype_to_candidate_list(symbol, &search_constant_type_c::bool_type_name); |
|
1172 return NULL; |
|
1173 } |
|
1174 |
|
1175 void *fill_candidate_datatypes_c::visit(LT_operator_c *symbol) { |
|
1176 bool found = false; |
|
1177 |
|
1178 if (NULL == prev_il_instruction) return NULL; |
|
1179 for(unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { |
|
1180 for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) { |
|
1181 if (is_type_equal(prev_il_instruction->candidate_datatypes[i], il_operand->candidate_datatypes[j]) |
|
1182 && is_ANY_ELEMENTARY_compatible(prev_il_instruction->candidate_datatypes[i])) { |
|
1183 found = true; |
|
1184 break; |
|
1185 } |
|
1186 } |
|
1187 } |
|
1188 if (found) add_datatype_to_candidate_list(symbol, &search_constant_type_c::bool_type_name); |
|
1189 return NULL; |
|
1190 } |
|
1191 |
|
1192 void *fill_candidate_datatypes_c::visit(LE_operator_c *symbol) { |
|
1193 bool found = false; |
|
1194 |
|
1195 if (NULL == prev_il_instruction) return NULL; |
|
1196 for(unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { |
|
1197 for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) { |
|
1198 if (is_type_equal(prev_il_instruction->candidate_datatypes[i], il_operand->candidate_datatypes[j]) |
|
1199 && is_ANY_ELEMENTARY_compatible(prev_il_instruction->candidate_datatypes[i])) { |
|
1200 found = true; |
|
1201 break; |
|
1202 } |
|
1203 } |
|
1204 } |
|
1205 if (found) add_datatype_to_candidate_list(symbol, &search_constant_type_c::bool_type_name); |
|
1206 return NULL; |
|
1207 } |
|
1208 |
|
1209 void *fill_candidate_datatypes_c::visit(NE_operator_c *symbol) { |
|
1210 bool found = false; |
|
1211 |
|
1212 if (NULL == prev_il_instruction) return NULL; |
|
1213 for(unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { |
|
1214 for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) { |
|
1215 if (is_type_equal(prev_il_instruction->candidate_datatypes[i], il_operand->candidate_datatypes[j]) |
|
1216 && is_ANY_ELEMENTARY_compatible(prev_il_instruction->candidate_datatypes[i])) { |
|
1217 found = true; |
|
1218 break; |
|
1219 } |
|
1220 } |
|
1221 } |
|
1222 if (found) add_datatype_to_candidate_list(symbol, &search_constant_type_c::bool_type_name); |
|
1223 return NULL; |
|
1224 } |
|
1225 |
1130 |
1226 void *fill_candidate_datatypes_c::visit(CAL_operator_c *symbol) { |
1131 void *fill_candidate_datatypes_c::visit(CAL_operator_c *symbol) { |
1227 if (NULL == prev_il_instruction) return NULL; |
1132 if (NULL == prev_il_instruction) return NULL; |
1228 for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { |
1133 for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { |
1229 /* does not need to be bool type !! */ |
1134 /* does not need to be bool type !! */ |
1319 /* B.3 - Language ST (Structured Text) */ |
1224 /* B.3 - Language ST (Structured Text) */ |
1320 /***************************************/ |
1225 /***************************************/ |
1321 /***********************/ |
1226 /***********************/ |
1322 /* B 3.1 - Expressions */ |
1227 /* B 3.1 - Expressions */ |
1323 /***********************/ |
1228 /***********************/ |
1324 void *fill_candidate_datatypes_c::visit(or_expression_c *symbol) {return handle_binary_expression(widen_OR_table, symbol, symbol->l_exp, symbol->r_exp);} |
1229 void *fill_candidate_datatypes_c::visit( or_expression_c *symbol) {return handle_binary_expression(widen_OR_table, symbol, symbol->l_exp, symbol->r_exp);} |
1325 void *fill_candidate_datatypes_c::visit(xor_expression_c *symbol) {return handle_binary_expression(widen_XOR_table, symbol, symbol->l_exp, symbol->r_exp);} |
1230 void *fill_candidate_datatypes_c::visit( xor_expression_c *symbol) {return handle_binary_expression(widen_XOR_table, symbol, symbol->l_exp, symbol->r_exp);} |
1326 void *fill_candidate_datatypes_c::visit(and_expression_c *symbol) {return handle_binary_expression(widen_AND_table, symbol, symbol->l_exp, symbol->r_exp);} |
1231 void *fill_candidate_datatypes_c::visit( and_expression_c *symbol) {return handle_binary_expression(widen_AND_table, symbol, symbol->l_exp, symbol->r_exp);} |
1327 |
1232 |
1328 |
1233 void *fill_candidate_datatypes_c::visit( equ_expression_c *symbol) {return handle_binary_expression(widen_CMP_table, symbol, symbol->l_exp, symbol->r_exp);} |
1329 void *fill_candidate_datatypes_c::visit(equ_expression_c *symbol) { |
1234 void *fill_candidate_datatypes_c::visit(notequ_expression_c *symbol) {return handle_binary_expression(widen_CMP_table, symbol, symbol->l_exp, symbol->r_exp);} |
1330 symbol->l_exp->accept(*this); |
1235 void *fill_candidate_datatypes_c::visit( lt_expression_c *symbol) {return handle_binary_expression(widen_CMP_table, symbol, symbol->l_exp, symbol->r_exp);} |
1331 symbol->r_exp->accept(*this); |
1236 void *fill_candidate_datatypes_c::visit( gt_expression_c *symbol) {return handle_binary_expression(widen_CMP_table, symbol, symbol->l_exp, symbol->r_exp);} |
1332 bool found = false; |
1237 void *fill_candidate_datatypes_c::visit( le_expression_c *symbol) {return handle_binary_expression(widen_CMP_table, symbol, symbol->l_exp, symbol->r_exp);} |
1333 |
1238 void *fill_candidate_datatypes_c::visit( ge_expression_c *symbol) {return handle_binary_expression(widen_CMP_table, symbol, symbol->l_exp, symbol->r_exp);} |
1334 for (unsigned int i = 0; i < symbol->l_exp->candidate_datatypes.size(); i++) { |
|
1335 for (unsigned int j = 0; j < symbol->r_exp->candidate_datatypes.size(); j++) { |
|
1336 if (is_type_equal(symbol->l_exp->candidate_datatypes[i], symbol->r_exp->candidate_datatypes[j]) |
|
1337 && is_ANY_ELEMENTARY_compatible(symbol->l_exp->candidate_datatypes[i])) { |
|
1338 found = true; |
|
1339 break; |
|
1340 } |
|
1341 } |
|
1342 } |
|
1343 if (found) add_datatype_to_candidate_list(symbol, &search_constant_type_c::bool_type_name); |
|
1344 return NULL; |
|
1345 } |
|
1346 |
|
1347 |
|
1348 void *fill_candidate_datatypes_c::visit(notequ_expression_c *symbol) { |
|
1349 symbol->l_exp->accept(*this); |
|
1350 symbol->r_exp->accept(*this); |
|
1351 bool found = false; |
|
1352 |
|
1353 for (unsigned int i = 0; i < symbol->l_exp->candidate_datatypes.size(); i++) { |
|
1354 for (unsigned int j = 0; j < symbol->r_exp->candidate_datatypes.size(); j++) { |
|
1355 if (is_type_equal(symbol->l_exp->candidate_datatypes[i], symbol->r_exp->candidate_datatypes[j]) |
|
1356 && is_ANY_ELEMENTARY_compatible(symbol->l_exp->candidate_datatypes[i])) { |
|
1357 found = true; |
|
1358 break; |
|
1359 } |
|
1360 } |
|
1361 } |
|
1362 if (found) |
|
1363 add_datatype_to_candidate_list(symbol, &search_constant_type_c::bool_type_name); |
|
1364 return NULL; |
|
1365 } |
|
1366 |
|
1367 |
|
1368 void *fill_candidate_datatypes_c::visit(lt_expression_c *symbol) { |
|
1369 symbol->l_exp->accept(*this); |
|
1370 symbol->r_exp->accept(*this); |
|
1371 bool found = false; |
|
1372 |
|
1373 for (unsigned int i = 0; i < symbol->l_exp->candidate_datatypes.size(); i++) { |
|
1374 for (unsigned int j = 0; j < symbol->r_exp->candidate_datatypes.size(); j++) { |
|
1375 if (is_type_equal(symbol->l_exp->candidate_datatypes[i], symbol->r_exp->candidate_datatypes[j]) |
|
1376 && is_ANY_ELEMENTARY_compatible(symbol->l_exp->candidate_datatypes[i])) { |
|
1377 found = true; |
|
1378 break; |
|
1379 } |
|
1380 } |
|
1381 } |
|
1382 if (found) |
|
1383 add_datatype_to_candidate_list(symbol, &search_constant_type_c::bool_type_name); |
|
1384 return NULL; |
|
1385 } |
|
1386 |
|
1387 |
|
1388 void *fill_candidate_datatypes_c::visit(gt_expression_c *symbol) { |
|
1389 symbol->l_exp->accept(*this); |
|
1390 symbol->r_exp->accept(*this); |
|
1391 bool found = false; |
|
1392 |
|
1393 for (unsigned int i = 0; i < symbol->l_exp->candidate_datatypes.size(); i++) { |
|
1394 for (unsigned int j = 0; j < symbol->r_exp->candidate_datatypes.size(); j++) { |
|
1395 if (is_type_equal(symbol->l_exp->candidate_datatypes[i], symbol->r_exp->candidate_datatypes[j]) |
|
1396 && is_ANY_ELEMENTARY_compatible(symbol->l_exp->candidate_datatypes[i])) { |
|
1397 found = true; |
|
1398 break; |
|
1399 } |
|
1400 } |
|
1401 } |
|
1402 if (found) |
|
1403 add_datatype_to_candidate_list(symbol, &search_constant_type_c::bool_type_name); |
|
1404 return NULL; |
|
1405 } |
|
1406 |
|
1407 void *fill_candidate_datatypes_c::visit(le_expression_c *symbol) { |
|
1408 symbol->l_exp->accept(*this); |
|
1409 symbol->r_exp->accept(*this); |
|
1410 bool found = false; |
|
1411 |
|
1412 for (unsigned int i = 0; i < symbol->l_exp->candidate_datatypes.size(); i++) { |
|
1413 for (unsigned int j = 0; j < symbol->r_exp->candidate_datatypes.size(); j++) { |
|
1414 if (is_type_equal(symbol->l_exp->candidate_datatypes[i], symbol->r_exp->candidate_datatypes[j]) |
|
1415 && is_ANY_ELEMENTARY_compatible(symbol->l_exp->candidate_datatypes[i])) { |
|
1416 found = true; |
|
1417 break; |
|
1418 } |
|
1419 } |
|
1420 } |
|
1421 if (found) |
|
1422 add_datatype_to_candidate_list(symbol, &search_constant_type_c::bool_type_name); |
|
1423 return NULL; |
|
1424 } |
|
1425 |
|
1426 void *fill_candidate_datatypes_c::visit(ge_expression_c *symbol) { |
|
1427 symbol->l_exp->accept(*this); |
|
1428 symbol->r_exp->accept(*this); |
|
1429 bool found = false; |
|
1430 |
|
1431 for (unsigned int i = 0; i < symbol->l_exp->candidate_datatypes.size(); i++) { |
|
1432 for (unsigned int j = 0; j < symbol->r_exp->candidate_datatypes.size(); j++) { |
|
1433 if (is_type_equal(symbol->l_exp->candidate_datatypes[i], symbol->r_exp->candidate_datatypes[j]) |
|
1434 && is_ANY_ELEMENTARY_compatible(symbol->l_exp->candidate_datatypes[i])) { |
|
1435 found = true; |
|
1436 break; |
|
1437 } |
|
1438 } |
|
1439 } |
|
1440 if (found) |
|
1441 add_datatype_to_candidate_list(symbol, &search_constant_type_c::bool_type_name); |
|
1442 return NULL; |
|
1443 } |
|
1444 |
1239 |
1445 |
1240 |
1446 /* The following code is correct when handling the addition of 2 symbolic_variables |
1241 /* The following code is correct when handling the addition of 2 symbolic_variables |
1447 * In this case, adding two variables (e.g. USINT_var1 + USINT_var2) will always yield |
1242 * In this case, adding two variables (e.g. USINT_var1 + USINT_var2) will always yield |
1448 * the same data type, even if the result of the adition could not fit inside the same |
1243 * the same data type, even if the result of the adition could not fit inside the same |