1173 return NULL; |
1173 return NULL; |
1174 } |
1174 } |
1175 |
1175 |
1176 void *fill_candidate_datatypes_c::visit(LDN_operator_c *symbol) { |
1176 void *fill_candidate_datatypes_c::visit(LDN_operator_c *symbol) { |
1177 for(unsigned int i = 0; i < il_operand->candidate_datatypes.size(); i++) { |
1177 for(unsigned int i = 0; i < il_operand->candidate_datatypes.size(); i++) { |
1178 if (is_ANY_BIT_compatible(il_operand->candidate_datatypes[i])) |
1178 if (get_datatype_info_c::is_ANY_BIT_compatible(il_operand->candidate_datatypes[i])) |
1179 add_datatype_to_candidate_list(symbol, il_operand->candidate_datatypes[i]); |
1179 add_datatype_to_candidate_list(symbol, il_operand->candidate_datatypes[i]); |
1180 } |
1180 } |
1181 if (debug) std::cout << "LDN [" << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
1181 if (debug) std::cout << "LDN [" << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
1182 return NULL; |
1182 return NULL; |
1183 } |
1183 } |
1204 if (NULL == prev_il_instruction) return NULL; |
1204 if (NULL == prev_il_instruction) return NULL; |
1205 for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { |
1205 for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { |
1206 for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) { |
1206 for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) { |
1207 prev_instruction_type = prev_il_instruction->candidate_datatypes[i]; |
1207 prev_instruction_type = prev_il_instruction->candidate_datatypes[i]; |
1208 operand_type = il_operand->candidate_datatypes[j]; |
1208 operand_type = il_operand->candidate_datatypes[j]; |
1209 if (is_type_equal(prev_instruction_type,operand_type) && is_ANY_BIT_compatible(operand_type)) |
1209 if (is_type_equal(prev_instruction_type,operand_type) && get_datatype_info_c::is_ANY_BIT_compatible(operand_type)) |
1210 add_datatype_to_candidate_list(symbol, prev_instruction_type); |
1210 add_datatype_to_candidate_list(symbol, prev_instruction_type); |
1211 } |
1211 } |
1212 } |
1212 } |
1213 if (debug) std::cout << "STN [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
1213 if (debug) std::cout << "STN [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
1214 return NULL; |
1214 return NULL; |
1221 * We therefore consider it an error if an il_operand is specified! |
1221 * We therefore consider it an error if an il_operand is specified! |
1222 * We do not need to generate an error message. This error will be caught somewhere else! |
1222 * We do not need to generate an error message. This error will be caught somewhere else! |
1223 */ |
1223 */ |
1224 if (NULL == prev_il_instruction) return NULL; |
1224 if (NULL == prev_il_instruction) return NULL; |
1225 for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { |
1225 for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { |
1226 if (is_ANY_BIT_compatible(prev_il_instruction->candidate_datatypes[i])) |
1226 if (get_datatype_info_c::is_ANY_BIT_compatible(prev_il_instruction->candidate_datatypes[i])) |
1227 add_datatype_to_candidate_list(symbol, prev_il_instruction->candidate_datatypes[i]); |
1227 add_datatype_to_candidate_list(symbol, prev_il_instruction->candidate_datatypes[i]); |
1228 } |
1228 } |
1229 if (debug) std::cout << "NOT_operator [" << prev_il_instruction->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
1229 if (debug) std::cout << "NOT_operator [" << prev_il_instruction->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
1230 return NULL; |
1230 return NULL; |
1231 } |
1231 } |
1242 operand_type = il_operand->candidate_datatypes[j]; |
1242 operand_type = il_operand->candidate_datatypes[j]; |
1243 /* TODO: I believe the following is wrong! The data types of prev_instruction_type and operand_type DO NOT have to be equal. |
1243 /* TODO: I believe the following is wrong! The data types of prev_instruction_type and operand_type DO NOT have to be equal. |
1244 * the prev_instruction_type MUST be BOOL compatible. |
1244 * the prev_instruction_type MUST be BOOL compatible. |
1245 * I am not too sure about operand_type, does it have to be BOOL compatible, or can it be ANY_BIT compatible? Must check! |
1245 * I am not too sure about operand_type, does it have to be BOOL compatible, or can it be ANY_BIT compatible? Must check! |
1246 */ |
1246 */ |
1247 if (is_type_equal(prev_instruction_type,operand_type) && is_ANY_BOOL_compatible(operand_type)) |
1247 if (is_type_equal(prev_instruction_type,operand_type) && get_datatype_info_c::is_BOOL_compatible(operand_type)) |
1248 add_datatype_to_candidate_list(symbol, prev_instruction_type); |
1248 add_datatype_to_candidate_list(symbol, prev_instruction_type); |
1249 } |
1249 } |
1250 } |
1250 } |
1251 if (debug) std::cout << "S [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
1251 if (debug) std::cout << "S [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
1252 return NULL; |
1252 return NULL; |
1264 operand_type = il_operand->candidate_datatypes[j]; |
1264 operand_type = il_operand->candidate_datatypes[j]; |
1265 /* TODO: I believe the following is wrong! The data types of prev_instruction_type and operand_type DO NOT have to be equal. |
1265 /* TODO: I believe the following is wrong! The data types of prev_instruction_type and operand_type DO NOT have to be equal. |
1266 * the prev_instruction_type MUST be BOOL compatible. |
1266 * the prev_instruction_type MUST be BOOL compatible. |
1267 * I am not too sure about operand_type, does it have to be BOOL compatible, or can it be ANY_BIT compatible? Must check! |
1267 * I am not too sure about operand_type, does it have to be BOOL compatible, or can it be ANY_BIT compatible? Must check! |
1268 */ |
1268 */ |
1269 if (is_type_equal(prev_instruction_type,operand_type) && is_ANY_BOOL_compatible(operand_type)) |
1269 if (is_type_equal(prev_instruction_type,operand_type) && get_datatype_info_c::is_BOOL_compatible(operand_type)) |
1270 add_datatype_to_candidate_list(symbol, prev_instruction_type); |
1270 add_datatype_to_candidate_list(symbol, prev_instruction_type); |
1271 } |
1271 } |
1272 } |
1272 } |
1273 if (debug) std::cout << "R [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
1273 if (debug) std::cout << "R [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
1274 return NULL; |
1274 return NULL; |
1307 |
1307 |
1308 |
1308 |
1309 void *fill_candidate_datatypes_c::handle_conditional_il_flow_control_operator(symbol_c *symbol) { |
1309 void *fill_candidate_datatypes_c::handle_conditional_il_flow_control_operator(symbol_c *symbol) { |
1310 if (NULL == prev_il_instruction) return NULL; |
1310 if (NULL == prev_il_instruction) return NULL; |
1311 for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { |
1311 for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { |
1312 if (is_ANY_BOOL_compatible(prev_il_instruction->candidate_datatypes[i])) |
1312 if (get_datatype_info_c::is_BOOL_compatible(prev_il_instruction->candidate_datatypes[i])) |
1313 add_datatype_to_candidate_list(symbol, prev_il_instruction->candidate_datatypes[i]); |
1313 add_datatype_to_candidate_list(symbol, prev_il_instruction->candidate_datatypes[i]); |
1314 } |
1314 } |
1315 return NULL; |
1315 return NULL; |
1316 } |
1316 } |
1317 |
1317 |
1393 * |
1393 * |
1394 * NOTE: The above argument also applies to the neg_integer_c method! |
1394 * NOTE: The above argument also applies to the neg_integer_c method! |
1395 */ |
1395 */ |
1396 symbol->exp->accept(*this); |
1396 symbol->exp->accept(*this); |
1397 for (unsigned int i = 0; i < symbol->exp->candidate_datatypes.size(); i++) { |
1397 for (unsigned int i = 0; i < symbol->exp->candidate_datatypes.size(); i++) { |
1398 if (is_ANY_signed_MAGNITUDE_compatible(symbol->exp->candidate_datatypes[i])) |
1398 if (get_datatype_info_c::is_ANY_signed_MAGNITUDE_compatible(symbol->exp->candidate_datatypes[i])) |
1399 add_datatype_to_candidate_list(symbol, symbol->exp->candidate_datatypes[i]); |
1399 add_datatype_to_candidate_list(symbol, symbol->exp->candidate_datatypes[i]); |
1400 } |
1400 } |
1401 if (debug) std::cout << "neg [" << symbol->exp->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
1401 if (debug) std::cout << "neg [" << symbol->exp->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
1402 return NULL; |
1402 return NULL; |
1403 } |
1403 } |
1404 |
1404 |
1405 |
1405 |
1406 void *fill_candidate_datatypes_c::visit(not_expression_c *symbol) { |
1406 void *fill_candidate_datatypes_c::visit(not_expression_c *symbol) { |
1407 symbol->exp->accept(*this); |
1407 symbol->exp->accept(*this); |
1408 for (unsigned int i = 0; i < symbol->exp->candidate_datatypes.size(); i++) { |
1408 for (unsigned int i = 0; i < symbol->exp->candidate_datatypes.size(); i++) { |
1409 if (is_ANY_BIT_compatible(symbol->exp->candidate_datatypes[i])) |
1409 if (get_datatype_info_c::is_ANY_BIT_compatible(symbol->exp->candidate_datatypes[i])) |
1410 add_datatype_to_candidate_list(symbol, symbol->exp->candidate_datatypes[i]); |
1410 add_datatype_to_candidate_list(symbol, symbol->exp->candidate_datatypes[i]); |
1411 } |
1411 } |
1412 if (debug) std::cout << "not [" << symbol->exp->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
1412 if (debug) std::cout << "not [" << symbol->exp->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; |
1413 return NULL; |
1413 return NULL; |
1414 } |
1414 } |