stage3/fill_candidate_datatypes.cc
changeset 483 7f839fb100c1
parent 481 16f943328696
child 484 f78750994a82
equal deleted inserted replaced
482:b62a5ecce54d 483:7f839fb100c1
  1104 void *fill_candidate_datatypes_c::visit(CD_operator_c  *symbol) {handle_implicit_il_fb_call(symbol,  "CD", symbol->called_fb_declaration); return NULL;}
  1104 void *fill_candidate_datatypes_c::visit(CD_operator_c  *symbol) {handle_implicit_il_fb_call(symbol,  "CD", symbol->called_fb_declaration); return NULL;}
  1105 void *fill_candidate_datatypes_c::visit(PV_operator_c  *symbol) {handle_implicit_il_fb_call(symbol,  "PV", symbol->called_fb_declaration); return NULL;}
  1105 void *fill_candidate_datatypes_c::visit(PV_operator_c  *symbol) {handle_implicit_il_fb_call(symbol,  "PV", symbol->called_fb_declaration); return NULL;}
  1106 void *fill_candidate_datatypes_c::visit(IN_operator_c  *symbol) {handle_implicit_il_fb_call(symbol,  "IN", symbol->called_fb_declaration); return NULL;}
  1106 void *fill_candidate_datatypes_c::visit(IN_operator_c  *symbol) {handle_implicit_il_fb_call(symbol,  "IN", symbol->called_fb_declaration); return NULL;}
  1107 void *fill_candidate_datatypes_c::visit(PT_operator_c  *symbol) {handle_implicit_il_fb_call(symbol,  "PT", symbol->called_fb_declaration); return NULL;}
  1107 void *fill_candidate_datatypes_c::visit(PT_operator_c  *symbol) {handle_implicit_il_fb_call(symbol,  "PT", symbol->called_fb_declaration); return NULL;}
  1108 
  1108 
  1109 void *fill_candidate_datatypes_c::visit(AND_operator_c *symbol) {return handle_binary_operator(widen_AND_table, symbol, prev_il_instruction, il_operand);}
  1109 void *fill_candidate_datatypes_c::visit( AND_operator_c *symbol) {return handle_binary_operator(widen_AND_table, symbol, prev_il_instruction, il_operand);}
  1110 void *fill_candidate_datatypes_c::visit(OR_operator_c  *symbol) {return handle_binary_operator(widen_OR_table,  symbol, prev_il_instruction, il_operand);}
  1110 void *fill_candidate_datatypes_c::visit( OR_operator_c  *symbol) {return handle_binary_operator( widen_OR_table, symbol, prev_il_instruction, il_operand);}
  1111 void *fill_candidate_datatypes_c::visit(XOR_operator_c *symbol) {return handle_binary_operator(widen_XOR_table, symbol, prev_il_instruction, il_operand);}
  1111 void *fill_candidate_datatypes_c::visit( XOR_operator_c *symbol) {return handle_binary_operator(widen_XOR_table, symbol, prev_il_instruction, il_operand);}
  1112 
  1112 void *fill_candidate_datatypes_c::visit(ANDN_operator_c *symbol) {return handle_binary_operator(widen_AND_table, symbol, prev_il_instruction, il_operand);}
  1113 
  1113 void *fill_candidate_datatypes_c::visit( ORN_operator_c *symbol) {return handle_binary_operator( widen_OR_table, symbol, prev_il_instruction, il_operand);}
  1114 void *fill_candidate_datatypes_c::visit(ANDN_operator_c *symbol) {
  1114 void *fill_candidate_datatypes_c::visit(XORN_operator_c *symbol) {return handle_binary_operator(widen_XOR_table, symbol, prev_il_instruction, il_operand);}
  1115 	symbol_c *prev_instruction_type, *operand_type;
       
  1116 
       
  1117 	if (NULL == prev_il_instruction) return NULL;
       
  1118 	for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) {
       
  1119 		for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) {
       
  1120 			prev_instruction_type = prev_il_instruction->candidate_datatypes[i];
       
  1121 			operand_type = il_operand->candidate_datatypes[j];
       
  1122 			if (is_type_equal(prev_instruction_type, operand_type) &&
       
  1123 					is_ANY_BIT_compatible(operand_type))
       
  1124 				add_datatype_to_candidate_list(symbol, prev_instruction_type);
       
  1125 		}
       
  1126 	}
       
  1127 	if (debug) std::cout <<  "ANDN [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> "  << symbol->candidate_datatypes.size() << " result.\n";
       
  1128 	return NULL;
       
  1129 }
       
  1130 
       
  1131 void *fill_candidate_datatypes_c::visit(ORN_operator_c *symbol) {
       
  1132 	symbol_c *prev_instruction_type, *operand_type;
       
  1133 
       
  1134 	if (NULL == prev_il_instruction) return NULL;
       
  1135 	for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) {
       
  1136 		for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) {
       
  1137 			prev_instruction_type = prev_il_instruction->candidate_datatypes[i];
       
  1138 			operand_type = il_operand->candidate_datatypes[j];
       
  1139 			if (is_type_equal(prev_instruction_type, operand_type) &&
       
  1140 					is_ANY_BIT_compatible(operand_type))
       
  1141 				add_datatype_to_candidate_list(symbol, prev_instruction_type);
       
  1142 		}
       
  1143 	}
       
  1144 	if (debug) std::cout <<  "ORN [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> "  << symbol->candidate_datatypes.size() << " result.\n";
       
  1145 	return NULL;
       
  1146 }
       
  1147 
       
  1148 void *fill_candidate_datatypes_c::visit(XORN_operator_c *symbol) {
       
  1149 	symbol_c *prev_instruction_type, *operand_type;
       
  1150 
       
  1151 	if (NULL == prev_il_instruction) return NULL;
       
  1152 	for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) {
       
  1153 		for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) {
       
  1154 			prev_instruction_type = prev_il_instruction->candidate_datatypes[i];
       
  1155 			operand_type = il_operand->candidate_datatypes[j];
       
  1156 			if (is_type_equal(prev_instruction_type, operand_type) &&
       
  1157 					is_ANY_BIT_compatible(operand_type))
       
  1158 				add_datatype_to_candidate_list(symbol, prev_instruction_type);
       
  1159 		}
       
  1160 	}
       
  1161 	if (debug) std::cout <<  "XORN [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> "  << symbol->candidate_datatypes.size() << " result.\n";
       
  1162 	return NULL;
       
  1163 }
       
  1164 
  1115 
  1165 void *fill_candidate_datatypes_c::visit(ADD_operator_c *symbol) {return handle_binary_operator(widen_ADD_table, symbol, prev_il_instruction, il_operand);}
  1116 void *fill_candidate_datatypes_c::visit(ADD_operator_c *symbol) {return handle_binary_operator(widen_ADD_table, symbol, prev_il_instruction, il_operand);}
  1166 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);}
  1167 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);}
  1168 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);}