diff -r 8a58d7b8b26c -r 16f943328696 stage3/fill_candidate_datatypes.cc --- a/stage3/fill_candidate_datatypes.cc Tue Mar 13 19:04:07 2012 +0000 +++ b/stage3/fill_candidate_datatypes.cc Wed Mar 14 10:26:03 2012 +0000 @@ -1106,8 +1106,12 @@ void *fill_candidate_datatypes_c::visit(IN_operator_c *symbol) {handle_implicit_il_fb_call(symbol, "IN", symbol->called_fb_declaration); return NULL;} void *fill_candidate_datatypes_c::visit(PT_operator_c *symbol) {handle_implicit_il_fb_call(symbol, "PT", symbol->called_fb_declaration); return NULL;} - -void *fill_candidate_datatypes_c::visit(AND_operator_c *symbol) { +void *fill_candidate_datatypes_c::visit(AND_operator_c *symbol) {return handle_binary_operator(widen_AND_table, symbol, prev_il_instruction, il_operand);} +void *fill_candidate_datatypes_c::visit(OR_operator_c *symbol) {return handle_binary_operator(widen_OR_table, symbol, prev_il_instruction, il_operand);} +void *fill_candidate_datatypes_c::visit(XOR_operator_c *symbol) {return handle_binary_operator(widen_XOR_table, symbol, prev_il_instruction, il_operand);} + + +void *fill_candidate_datatypes_c::visit(ANDN_operator_c *symbol) { symbol_c *prev_instruction_type, *operand_type; if (NULL == prev_il_instruction) return NULL; @@ -1120,11 +1124,11 @@ add_datatype_to_candidate_list(symbol, prev_instruction_type); } } - if (debug) std::cout << "AND [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; - return NULL; -} - -void *fill_candidate_datatypes_c::visit(OR_operator_c *symbol) { + if (debug) std::cout << "ANDN [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; + return NULL; +} + +void *fill_candidate_datatypes_c::visit(ORN_operator_c *symbol) { symbol_c *prev_instruction_type, *operand_type; if (NULL == prev_il_instruction) return NULL; @@ -1137,11 +1141,11 @@ add_datatype_to_candidate_list(symbol, prev_instruction_type); } } - if (debug) std::cout << "OR [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; - return NULL; -} - -void *fill_candidate_datatypes_c::visit(XOR_operator_c *symbol) { + if (debug) std::cout << "ORN [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; + return NULL; +} + +void *fill_candidate_datatypes_c::visit(XORN_operator_c *symbol) { symbol_c *prev_instruction_type, *operand_type; if (NULL == prev_il_instruction) return NULL; @@ -1154,57 +1158,6 @@ add_datatype_to_candidate_list(symbol, prev_instruction_type); } } - if (debug) std::cout << "XOR [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; - return NULL; -} - -void *fill_candidate_datatypes_c::visit(ANDN_operator_c *symbol) { - symbol_c *prev_instruction_type, *operand_type; - - if (NULL == prev_il_instruction) return NULL; - for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { - 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_BIT_compatible(operand_type)) - add_datatype_to_candidate_list(symbol, prev_instruction_type); - } - } - if (debug) std::cout << "ANDN [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; - return NULL; -} - -void *fill_candidate_datatypes_c::visit(ORN_operator_c *symbol) { - symbol_c *prev_instruction_type, *operand_type; - - if (NULL == prev_il_instruction) return NULL; - for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { - 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_BIT_compatible(operand_type)) - add_datatype_to_candidate_list(symbol, prev_instruction_type); - } - } - if (debug) std::cout << "ORN [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; - return NULL; -} - -void *fill_candidate_datatypes_c::visit(XORN_operator_c *symbol) { - symbol_c *prev_instruction_type, *operand_type; - - if (NULL == prev_il_instruction) return NULL; - for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { - 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_BIT_compatible(operand_type)) - add_datatype_to_candidate_list(symbol, prev_instruction_type); - } - } if (debug) std::cout << "XORN [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; return NULL; } @@ -1417,49 +1370,9 @@ /***********************/ /* B 3.1 - Expressions */ /***********************/ - -void *fill_candidate_datatypes_c::visit(or_expression_c *symbol) { - symbol->l_exp->accept(*this); - symbol->r_exp->accept(*this); - for (unsigned int i = 0; i < symbol->l_exp->candidate_datatypes.size(); i++) { - for (unsigned int j = 0; j < symbol->r_exp->candidate_datatypes.size(); j++) { - if (is_type_equal(symbol->l_exp->candidate_datatypes[i], symbol->r_exp->candidate_datatypes[j]) - && is_ANY_BIT_compatible(symbol->l_exp->candidate_datatypes[i])) - add_datatype_to_candidate_list(symbol, symbol->l_exp->candidate_datatypes[i]); - } - } - return NULL; -} - - -void *fill_candidate_datatypes_c::visit(xor_expression_c *symbol) { - symbol->l_exp->accept(*this); - symbol->r_exp->accept(*this); - - for (unsigned int i = 0; i < symbol->l_exp->candidate_datatypes.size(); i++) { - for (unsigned int j = 0; j < symbol->r_exp->candidate_datatypes.size(); j++) { - if (is_type_equal(symbol->l_exp->candidate_datatypes[i], symbol->r_exp->candidate_datatypes[j]) - && is_ANY_BIT_compatible(symbol->l_exp->candidate_datatypes[i])) - add_datatype_to_candidate_list(symbol, symbol->l_exp->candidate_datatypes[i]); - } - } - return NULL; -} - - -void *fill_candidate_datatypes_c::visit(and_expression_c *symbol) { - symbol->l_exp->accept(*this); - symbol->r_exp->accept(*this); - - for (unsigned int i = 0; i < symbol->l_exp->candidate_datatypes.size(); i++) { - for (unsigned int j = 0; j < symbol->r_exp->candidate_datatypes.size(); j++) { - if (is_type_equal(symbol->l_exp->candidate_datatypes[i], symbol->r_exp->candidate_datatypes[j]) - && is_ANY_BIT_compatible(symbol->l_exp->candidate_datatypes[i])) - add_datatype_to_candidate_list(symbol, symbol->l_exp->candidate_datatypes[i]); - } - } - return NULL; -} +void *fill_candidate_datatypes_c::visit(or_expression_c *symbol) {return handle_binary_expression(widen_OR_table, symbol, symbol->l_exp, symbol->r_exp);} +void *fill_candidate_datatypes_c::visit(xor_expression_c *symbol) {return handle_binary_expression(widen_XOR_table, symbol, symbol->l_exp, symbol->r_exp);} +void *fill_candidate_datatypes_c::visit(and_expression_c *symbol) {return handle_binary_expression(widen_AND_table, symbol, symbol->l_exp, symbol->r_exp);} void *fill_candidate_datatypes_c::visit(equ_expression_c *symbol) {