--- a/stage3/datatype_functions.cc Tue Mar 13 12:39:09 2012 +0000
+++ b/stage3/datatype_functions.cc Tue Mar 13 16:38:21 2012 +0000
@@ -88,13 +88,28 @@
*/
const struct widen_entry widen_ADD_table[] = {
- { &search_constant_type_c::time_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::time_type_name, widen_entry::ok },
- { &search_constant_type_c::tod_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::tod_type_name, widen_entry::deprecated },
- /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
- { &search_constant_type_c::time_type_name, &search_constant_type_c::tod_type_name, &search_constant_type_c::tod_type_name, widen_entry::deprecated },
- { &search_constant_type_c::dt_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::dt_type_name, widen_entry::deprecated },
- /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
- { &search_constant_type_c::time_type_name, &search_constant_type_c::dt_type_name, &search_constant_type_c::dt_type_name, widen_entry::deprecated },
+#define __add(TYPE) \
+ { &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, widen_entry::ok }, \
+ { &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, widen_entry::ok }, \
+ { &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, widen_entry::ok }, \
+ { &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::safe##TYPE##_type_name, widen_entry::ok },
+ __ANY_NUM(__add)
+#undef __add
+
+ /*******************************************/
+ /*******************************************/
+ /*** Operations with TIME, DT and TOD... ***/
+ /*******************************************/
+ /*******************************************/
+ { &search_constant_type_c::time_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::time_type_name, widen_entry::ok },
+ { &search_constant_type_c::tod_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::tod_type_name, widen_entry::deprecated },
+ /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
+ /* not currently supported by stage4, so it is best no tto add it for now... */
+// { &search_constant_type_c::time_type_name, &search_constant_type_c::tod_type_name, &search_constant_type_c::tod_type_name, widen_entry::deprecated },
+ { &search_constant_type_c::dt_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::dt_type_name, widen_entry::deprecated },
+ /* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
+ /* not currently supported by stage4, so it is best no tto add it for now... */
+// { &search_constant_type_c::time_type_name, &search_constant_type_c::dt_type_name, &search_constant_type_c::dt_type_name, widen_entry::deprecated },
/*******************************/
/* SAFE version on the left... */
@@ -102,10 +117,12 @@
{ &search_constant_type_c::safetime_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::time_type_name, widen_entry::ok },
{ &search_constant_type_c::safetod_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::tod_type_name, widen_entry::deprecated },
/* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
- { &search_constant_type_c::safetime_type_name, &search_constant_type_c::tod_type_name, &search_constant_type_c::tod_type_name, widen_entry::deprecated },
+ /* not currently supported by stage4, so it is best no tto add it for now... */
+// { &search_constant_type_c::safetime_type_name, &search_constant_type_c::tod_type_name, &search_constant_type_c::tod_type_name, widen_entry::deprecated },
{ &search_constant_type_c::safedt_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::dt_type_name, widen_entry::deprecated },
/* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
- { &search_constant_type_c::safetime_type_name, &search_constant_type_c::dt_type_name, &search_constant_type_c::dt_type_name, widen_entry::deprecated },
+ /* not currently supported by stage4, so it is best no tto add it for now... */
+// { &search_constant_type_c::safetime_type_name, &search_constant_type_c::dt_type_name, &search_constant_type_c::dt_type_name, widen_entry::deprecated },
/********************************/
/* SAFE version on the right... */
@@ -113,10 +130,12 @@
{ &search_constant_type_c::time_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::time_type_name, widen_entry::ok },
{ &search_constant_type_c::tod_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::tod_type_name, widen_entry::deprecated },
/* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
- { &search_constant_type_c::time_type_name, &search_constant_type_c::safetod_type_name, &search_constant_type_c::tod_type_name, widen_entry::deprecated },
+ /* not currently supported by stage4, so it is best no tto add it for now... */
+// { &search_constant_type_c::time_type_name, &search_constant_type_c::safetod_type_name, &search_constant_type_c::tod_type_name, widen_entry::deprecated },
{ &search_constant_type_c::dt_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::dt_type_name, widen_entry::deprecated },
/* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
- { &search_constant_type_c::time_type_name, &search_constant_type_c::safedt_type_name, &search_constant_type_c::dt_type_name, widen_entry::deprecated },
+ /* not currently supported by stage4, so it is best no tto add it for now... */
+// { &search_constant_type_c::time_type_name, &search_constant_type_c::safedt_type_name, &search_constant_type_c::dt_type_name, widen_entry::deprecated },
/*************************************/
/* SAFE version on left and right... */
@@ -124,10 +143,12 @@
{ &search_constant_type_c::safetime_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::safetime_type_name, widen_entry::ok },
{ &search_constant_type_c::safetod_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::safetod_type_name, widen_entry::deprecated },
/* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
- { &search_constant_type_c::safetime_type_name, &search_constant_type_c::safetod_type_name, &search_constant_type_c::safetod_type_name, widen_entry::deprecated },
+ /* not currently supported by stage4, so it is best no tto add it for now... */
+// { &search_constant_type_c::safetime_type_name, &search_constant_type_c::safetod_type_name, &search_constant_type_c::safetod_type_name, widen_entry::deprecated },
{ &search_constant_type_c::safedt_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::safedt_type_name, widen_entry::deprecated },
/* NOTE: the standard des not explicitly support the following semantics. However, since 'addition' is supposed to be commutative, we add it anyway... */
- { &search_constant_type_c::safetime_type_name, &search_constant_type_c::safedt_type_name, &search_constant_type_c::safedt_type_name, widen_entry::deprecated },
+ /* not currently supported by stage4, so it is best no tto add it for now... */
+// { &search_constant_type_c::safetime_type_name, &search_constant_type_c::safedt_type_name, &search_constant_type_c::safedt_type_name, widen_entry::deprecated },
{ NULL, NULL, NULL, widen_entry::ok },
};
@@ -139,6 +160,19 @@
const struct widen_entry widen_SUB_table[] = {
+#define __sub(TYPE) \
+ { &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, widen_entry::ok }, \
+ { &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, widen_entry::ok }, \
+ { &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, widen_entry::ok }, \
+ { &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::safe##TYPE##_type_name, widen_entry::ok },
+ __ANY_NUM(__sub)
+#undef __sub
+
+ /*******************************************/
+ /*******************************************/
+ /*** Operations with TIME, DT and TOD... ***/
+ /*******************************************/
+ /*******************************************/
{ &search_constant_type_c::time_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::time_type_name, widen_entry::ok },
{ &search_constant_type_c::date_type_name, &search_constant_type_c::date_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated },
{ &search_constant_type_c::tod_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::tod_type_name, widen_entry::deprecated },
@@ -159,22 +193,22 @@
/********************************/
/* SAFE version on the right... */
/********************************/
- { &search_constant_type_c::time_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::time_type_name, widen_entry::ok },
- { &search_constant_type_c::date_type_name, &search_constant_type_c::safedate_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated },
- { &search_constant_type_c::tod_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::tod_type_name, widen_entry::deprecated },
- { &search_constant_type_c::tod_type_name, &search_constant_type_c::safetod_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated },
- { &search_constant_type_c::dt_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::dt_type_name, widen_entry::deprecated },
- { &search_constant_type_c::dt_type_name, &search_constant_type_c::safedt_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated },
+ { &search_constant_type_c::time_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::time_type_name, widen_entry::ok },
+ { &search_constant_type_c::date_type_name, &search_constant_type_c::safedate_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated },
+ { &search_constant_type_c::tod_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::tod_type_name, widen_entry::deprecated },
+ { &search_constant_type_c::tod_type_name, &search_constant_type_c::safetod_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated },
+ { &search_constant_type_c::dt_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::dt_type_name, widen_entry::deprecated },
+ { &search_constant_type_c::dt_type_name, &search_constant_type_c::safedt_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated },
/*************************************/
/* SAFE version on left and right... */
/*************************************/
- { &search_constant_type_c::safetime_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::safetime_type_name, widen_entry::ok },
- { &search_constant_type_c::safedate_type_name, &search_constant_type_c::safedate_type_name, &search_constant_type_c::safetime_type_name, widen_entry::deprecated },
- { &search_constant_type_c::safetod_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::safetod_type_name, widen_entry::deprecated },
- { &search_constant_type_c::safetod_type_name, &search_constant_type_c::safetod_type_name, &search_constant_type_c::safetime_type_name, widen_entry::deprecated },
- { &search_constant_type_c::safedt_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::safedt_type_name, widen_entry::deprecated },
- { &search_constant_type_c::safedt_type_name, &search_constant_type_c::safedt_type_name, &search_constant_type_c::safetime_type_name, widen_entry::deprecated },
+ { &search_constant_type_c::safetime_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::safetime_type_name, widen_entry::ok },
+ { &search_constant_type_c::safedate_type_name, &search_constant_type_c::safedate_type_name, &search_constant_type_c::safetime_type_name, widen_entry::deprecated },
+ { &search_constant_type_c::safetod_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::safetod_type_name, widen_entry::deprecated },
+ { &search_constant_type_c::safetod_type_name, &search_constant_type_c::safetod_type_name, &search_constant_type_c::safetime_type_name, widen_entry::deprecated },
+ { &search_constant_type_c::safedt_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::safedt_type_name, widen_entry::deprecated },
+ { &search_constant_type_c::safedt_type_name, &search_constant_type_c::safedt_type_name, &search_constant_type_c::safetime_type_name, widen_entry::deprecated },
{ NULL, NULL, NULL, widen_entry::ok },
};
@@ -186,17 +220,29 @@
const struct widen_entry widen_MUL_table[] = {
+#define __mul(TYPE) \
+ { &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, widen_entry::ok }, \
+ { &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, widen_entry::ok }, \
+ { &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, widen_entry::ok }, \
+ { &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::safe##TYPE##_type_name, widen_entry::ok },
+ __ANY_NUM(__mul)
+#undef __mul
+
+ /*******************************************/
+ /*******************************************/
+ /*** Operations with TIME, DT and TOD... ***/
+ /*******************************************/
+ /*******************************************/
#define __multime(TYPE) \
- { &search_constant_type_c::time_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
- { &search_constant_type_c::safetime_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
- { &search_constant_type_c::time_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
- { &search_constant_type_c::safetime_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::safetime_type_name, widen_entry::deprecated }, \
+ { &search_constant_type_c::time_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
+ { &search_constant_type_c::safetime_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
+ { &search_constant_type_c::time_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
+ { &search_constant_type_c::safetime_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::safetime_type_name, widen_entry::deprecated }, \
/* NOTE: the standard des not explicitly support the following semantics. However, since 'multiplication' is supposed to be commutative, we add it anyway... */ \
- { &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
- { &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
- { &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
- { &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::safetime_type_name, widen_entry::deprecated },
-
+ { &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
+ { &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::time_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
+ { &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
+ { &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::safetime_type_name, &search_constant_type_c::safetime_type_name, widen_entry::deprecated },
__ANY_NUM(__multime)
#undef __multime
@@ -208,11 +254,24 @@
const struct widen_entry widen_DIV_table[] = {
+#define __div(TYPE) \
+ { &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, widen_entry::ok }, \
+ { &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, widen_entry::ok }, \
+ { &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::TYPE##_type_name, widen_entry::ok }, \
+ { &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::safe##TYPE##_type_name, widen_entry::ok },
+ __ANY_NUM(__div)
+#undef __div
+
+ /*******************************************/
+ /*******************************************/
+ /*** Operations with TIME, DT and TOD... ***/
+ /*******************************************/
+ /*******************************************/
#define __divtime(TYPE) \
- { &search_constant_type_c::time_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
- { &search_constant_type_c::safetime_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
- { &search_constant_type_c::time_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
- { &search_constant_type_c::safetime_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::safetime_type_name, widen_entry::deprecated },
+ { &search_constant_type_c::time_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
+ { &search_constant_type_c::safetime_type_name, &search_constant_type_c::TYPE##_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
+ { &search_constant_type_c::time_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::time_type_name, widen_entry::deprecated }, \
+ { &search_constant_type_c::safetime_type_name, &search_constant_type_c::safe##TYPE##_type_name, &search_constant_type_c::safetime_type_name, widen_entry::deprecated },
__ANY_NUM(__divtime)
#undef __divtime
--- a/stage3/fill_candidate_datatypes.cc Tue Mar 13 12:39:09 2012 +0000
+++ b/stage3/fill_candidate_datatypes.cc Tue Mar 13 16:38:21 2012 +0000
@@ -53,14 +53,12 @@
fill_candidate_datatypes_c::~fill_candidate_datatypes_c(void) {
}
-symbol_c *fill_candidate_datatypes_c::widening_conversion(symbol_c *left_type, symbol_c *right_type, const struct widen_entry widen_table[], bool &deprecated_operation) {
+symbol_c *fill_candidate_datatypes_c::widening_conversion(symbol_c *left_type, symbol_c *right_type, const struct widen_entry widen_table[]) {
int k;
/* find a widening table entry compatible */
for (k = 0; NULL != widen_table[k].left; k++)
- if ((typeid(*left_type) == typeid(*widen_table[k].left)) && (typeid(*right_type) == typeid(*widen_table[k].right))) {
- deprecated_operation = (widen_table[k].status == widen_entry::deprecated);
+ if ((typeid(*left_type) == typeid(*widen_table[k].left)) && (typeid(*right_type) == typeid(*widen_table[k].right)))
return widen_table[k].result;
- }
return NULL;
}
@@ -68,6 +66,12 @@
/* add a data type to a candidate data type list, while guaranteeing no duplicate entries! */
/* Returns true if it really did add the datatype to the list, or false if it was already present in the list! */
bool fill_candidate_datatypes_c::add_datatype_to_candidate_list(symbol_c *symbol, symbol_c *datatype) {
+ /* If it is an invalid data type, do not insert!
+ * NOTE: it reduces overall code size to do this test here, instead of doing every time before calling the add_datatype_to_candidate_list() function.
+ */
+ if (!is_type_valid(datatype)) /* checks for NULL and invalid_type_name_c */
+ return false;
+
if (search_in_candidate_datatype_list(datatype, symbol->candidate_datatypes) >= 0)
/* already in the list, Just return! */
return false;
@@ -1278,15 +1282,8 @@
for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) {
prev_instruction_type = prev_il_instruction->candidate_datatypes[i];
operand_type = il_operand->candidate_datatypes[j];
- if (is_type_equal(prev_instruction_type, operand_type) &&
- is_ANY_NUM_compatible(prev_instruction_type))
- add_datatype_to_candidate_list(symbol, prev_instruction_type);
- else {
- symbol_c *result = widening_conversion(prev_instruction_type, operand_type, widen_ADD_table, symbol->deprecated_operation);
- if (result)
- add_datatype_to_candidate_list(symbol, result);
-
- }
+ /* NOTE: add_datatype_to_candidate_list() will only really add the datatype if it is != NULL !!! */
+ add_datatype_to_candidate_list(symbol, widening_conversion(prev_instruction_type, operand_type, widen_ADD_table));
}
}
if (debug) std::cout << "ADD [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n";
@@ -1302,14 +1299,8 @@
for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) {
prev_instruction_type = prev_il_instruction->candidate_datatypes[i];
operand_type = il_operand->candidate_datatypes[j];
- if (is_type_equal(prev_instruction_type, operand_type) &&
- is_ANY_NUM_compatible(prev_instruction_type))
- add_datatype_to_candidate_list(symbol, prev_instruction_type);
- else {
- symbol_c *result = widening_conversion(prev_instruction_type, operand_type, widen_SUB_table, symbol->deprecated_operation);
- if (result)
- add_datatype_to_candidate_list(symbol, result);
- }
+ /* NOTE: add_datatype_to_candidate_list() will only really add the datatype if it is != NULL !!! */
+ add_datatype_to_candidate_list(symbol, widening_conversion(prev_instruction_type, operand_type, widen_SUB_table));
}
}
if (debug) std::cout << "SUB [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n";
@@ -1325,14 +1316,8 @@
for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) {
prev_instruction_type = prev_il_instruction->candidate_datatypes[i];
operand_type = il_operand->candidate_datatypes[j];
- if (is_type_equal(prev_instruction_type, operand_type) &&
- is_ANY_NUM_compatible(prev_instruction_type))
- add_datatype_to_candidate_list(symbol, prev_instruction_type);
- else {
- symbol_c *result = widening_conversion(prev_instruction_type, operand_type, widen_MUL_table, symbol->deprecated_operation);
- if (result)
- add_datatype_to_candidate_list(symbol, result);
- }
+ /* NOTE: add_datatype_to_candidate_list() will only really add the datatype if it is != NULL !!! */
+ add_datatype_to_candidate_list(symbol, widening_conversion(prev_instruction_type, operand_type, widen_MUL_table));
}
}
if (debug) std::cout << "MUL [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n";
@@ -1348,14 +1333,8 @@
for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) {
prev_instruction_type = prev_il_instruction->candidate_datatypes[i];
operand_type = il_operand->candidate_datatypes[j];
- if (is_type_equal(prev_instruction_type, operand_type) &&
- is_ANY_NUM_compatible(prev_instruction_type))
- add_datatype_to_candidate_list(symbol, prev_instruction_type);
- else {
- symbol_c *result = widening_conversion(prev_instruction_type, operand_type, widen_DIV_table, symbol->deprecated_operation);
- if (result)
- add_datatype_to_candidate_list(symbol, result);
- }
+ /* NOTE: add_datatype_to_candidate_list() will only really add the datatype if it is != NULL !!! */
+ add_datatype_to_candidate_list(symbol, widening_conversion(prev_instruction_type, operand_type, widen_DIV_table));
}
}
if (debug) std::cout << "DIV [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n";
@@ -1771,13 +1750,8 @@
for(unsigned int j = 0; j < symbol->r_exp->candidate_datatypes.size(); j++) {
left_type = symbol->l_exp->candidate_datatypes[i];
right_type = symbol->r_exp->candidate_datatypes[j];
- if (is_type_equal(left_type, right_type) && is_ANY_NUM_compatible(left_type))
- add_datatype_to_candidate_list(symbol, left_type);
- else {
- symbol_c *result = widening_conversion(left_type, right_type, widen_ADD_table, symbol->deprecated_operation);
- if (result)
- add_datatype_to_candidate_list(symbol, result);
- }
+ /* NOTE: add_datatype_to_candidate_list() will only really add the datatype if it is != NULL !!! */
+ add_datatype_to_candidate_list(symbol, widening_conversion(left_type, right_type, widen_ADD_table));
}
}
if (debug) std::cout << "+ [" << symbol->l_exp->candidate_datatypes.size() << "," << symbol->r_exp->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n";
@@ -1795,13 +1769,8 @@
for(unsigned int j = 0; j < symbol->r_exp->candidate_datatypes.size(); j++) {
left_type = symbol->l_exp->candidate_datatypes[i];
right_type = symbol->r_exp->candidate_datatypes[j];
- if (is_type_equal(left_type, right_type) && is_ANY_NUM_compatible(left_type))
- add_datatype_to_candidate_list(symbol, left_type);
- else {
- symbol_c *result = widening_conversion(left_type, right_type, widen_SUB_table, symbol->deprecated_operation);
- if (result)
- add_datatype_to_candidate_list(symbol, result);
- }
+ /* NOTE: add_datatype_to_candidate_list() will only really add the datatype if it is != NULL !!! */
+ add_datatype_to_candidate_list(symbol, widening_conversion(left_type, right_type, widen_SUB_table));
}
}
if (debug) std::cout << "- [" << symbol->l_exp->candidate_datatypes.size() << "," << symbol->r_exp->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n";
@@ -1819,14 +1788,8 @@
for(unsigned int j = 0; j < symbol->r_exp->candidate_datatypes.size(); j++) {
left_type = symbol->l_exp->candidate_datatypes[i];
right_type = symbol->r_exp->candidate_datatypes[j];
- if (is_type_equal(left_type, right_type) && is_ANY_NUM_compatible(left_type))
- add_datatype_to_candidate_list(symbol, left_type);
- else {
- symbol_c *result = widening_conversion(left_type, right_type, widen_MUL_table, symbol->deprecated_operation);
- if (result)
- add_datatype_to_candidate_list(symbol, result);
- }
-
+ /* NOTE: add_datatype_to_candidate_list() will only really add the datatype if it is != NULL !!! */
+ add_datatype_to_candidate_list(symbol, widening_conversion(left_type, right_type, widen_MUL_table));
}
}
if (debug) std::cout << "* [" << symbol->l_exp->candidate_datatypes.size() << "," << symbol->r_exp->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n";
@@ -1844,14 +1807,8 @@
for(unsigned int j = 0; j < symbol->r_exp->candidate_datatypes.size(); j++) {
left_type = symbol->l_exp->candidate_datatypes[i];
right_type = symbol->r_exp->candidate_datatypes[j];
- if (is_type_equal(left_type, right_type) && is_ANY_NUM_type(left_type))
- add_datatype_to_candidate_list(symbol, left_type);
- else {
- symbol_c *result = widening_conversion(left_type, right_type, widen_DIV_table, symbol->deprecated_operation);
- if (result)
- add_datatype_to_candidate_list(symbol, result);
- }
-
+ /* NOTE: add_datatype_to_candidate_list() will only really add the datatype if it is != NULL !!! */
+ add_datatype_to_candidate_list(symbol, widening_conversion(left_type, right_type, widen_DIV_table));
}
}
if (debug) std::cout << "/ [" << symbol->l_exp->candidate_datatypes.size() << "," << symbol->r_exp->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n";