stage3/fill_candidate_datatypes.cc
changeset 473 933d6c204607
parent 472 d26759a2274a
child 476 38d85e9a0507
equal deleted inserted replaced
472:d26759a2274a 473:933d6c204607
  1087 	if (NULL == prev_il_instruction) return NULL;
  1087 	if (NULL == prev_il_instruction) return NULL;
  1088 	for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) {
  1088 	for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) {
  1089 		for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) {
  1089 		for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) {
  1090 			prev_instruction_type = prev_il_instruction->candidate_datatypes[i];
  1090 			prev_instruction_type = prev_il_instruction->candidate_datatypes[i];
  1091 			operand_type = il_operand->candidate_datatypes[j];
  1091 			operand_type = il_operand->candidate_datatypes[j];
       
  1092 			/* TODO: I believe the following is wrong! The data types of prev_instruction_type and operand_type DO NOT have to be equal.
       
  1093 			 * the prev_instruction_type MUST be BOOL compatible.
       
  1094 			 * I am not too sure about operand_type, does it have to be BOOL compatible, or can it be ANY_BIT compatible? Must check!
       
  1095 			 */
  1092 			if (is_type_equal(prev_instruction_type,operand_type) && is_ANY_BOOL_compatible(operand_type))
  1096 			if (is_type_equal(prev_instruction_type,operand_type) && is_ANY_BOOL_compatible(operand_type))
  1093 				add_datatype_to_candidate_list(symbol, prev_instruction_type);
  1097 				add_datatype_to_candidate_list(symbol, prev_instruction_type);
  1094 		}
  1098 		}
  1095 	}
  1099 	}
  1096 	if (debug) std::cout << "S [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> "  << symbol->candidate_datatypes.size() << " result.\n";
  1100 	if (debug) std::cout << "S [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> "  << symbol->candidate_datatypes.size() << " result.\n";
  1105 	if (NULL == prev_il_instruction) return NULL;
  1109 	if (NULL == prev_il_instruction) return NULL;
  1106 	for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) {
  1110 	for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) {
  1107 		for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) {
  1111 		for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) {
  1108 			prev_instruction_type = prev_il_instruction->candidate_datatypes[i];
  1112 			prev_instruction_type = prev_il_instruction->candidate_datatypes[i];
  1109 			operand_type = il_operand->candidate_datatypes[j];
  1113 			operand_type = il_operand->candidate_datatypes[j];
       
  1114 			/* TODO: I believe the following is wrong! The data types of prev_instruction_type and operand_type DO NOT have to be equal.
       
  1115 			 * the prev_instruction_type MUST be BOOL compatible.
       
  1116 			 * I am not too sure about operand_type, does it have to be BOOL compatible, or can it be ANY_BIT compatible? Must check!
       
  1117 			 */
  1110 			if (is_type_equal(prev_instruction_type,operand_type) && is_ANY_BOOL_compatible(operand_type))
  1118 			if (is_type_equal(prev_instruction_type,operand_type) && is_ANY_BOOL_compatible(operand_type))
  1111 				add_datatype_to_candidate_list(symbol, prev_instruction_type);
  1119 				add_datatype_to_candidate_list(symbol, prev_instruction_type);
  1112 		}
  1120 		}
  1113 	}
  1121 	}
  1114 	if (debug) std::cout << "R [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> "  << symbol->candidate_datatypes.size() << " result.\n";
  1122 	if (debug) std::cout << "R [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> "  << symbol->candidate_datatypes.size() << " result.\n";