stage3/narrow_candidate_datatypes.cc
changeset 674 b221168a36f1
parent 673 90d7636e3c39
child 675 59fc28d4b06c
equal deleted inserted replaced
673:90d7636e3c39 674:b221168a36f1
    66 static int debug = 0;
    66 static int debug = 0;
    67 
    67 
    68 narrow_candidate_datatypes_c::narrow_candidate_datatypes_c(symbol_c *ignore) {
    68 narrow_candidate_datatypes_c::narrow_candidate_datatypes_c(symbol_c *ignore) {
    69 	search_varfb_instance_type = NULL;
    69 	search_varfb_instance_type = NULL;
    70 	fake_prev_il_instruction = NULL;
    70 	fake_prev_il_instruction = NULL;
       
    71 	current_il_instruction   = NULL;
    71 	il_operand = NULL;
    72 	il_operand = NULL;
    72 }
    73 }
    73 
    74 
    74 narrow_candidate_datatypes_c::~narrow_candidate_datatypes_c(void) {
    75 narrow_candidate_datatypes_c::~narrow_candidate_datatypes_c(void) {
    75 }
    76 }
   633 		 */
   634 		 */
   634 		tmp_prev_il_instruction.prev_il_instruction = symbol->prev_il_instruction;
   635 		tmp_prev_il_instruction.prev_il_instruction = symbol->prev_il_instruction;
   635 		intersect_prev_candidate_datatype_lists(&tmp_prev_il_instruction);
   636 		intersect_prev_candidate_datatype_lists(&tmp_prev_il_instruction);
   636 		/* Tell the il_instruction the datatype that it must generate - this was chosen by the next il_instruction (remember: we are iterating backwards!) */
   637 		/* Tell the il_instruction the datatype that it must generate - this was chosen by the next il_instruction (remember: we are iterating backwards!) */
   637 		fake_prev_il_instruction = &tmp_prev_il_instruction;
   638 		fake_prev_il_instruction = &tmp_prev_il_instruction;
       
   639 		current_il_instruction   = symbol;
   638 		symbol->il_instruction->datatype = symbol->datatype;
   640 		symbol->il_instruction->datatype = symbol->datatype;
   639 		symbol->il_instruction->accept(*this);
   641 		symbol->il_instruction->accept(*this);
   640 		fake_prev_il_instruction = NULL;
   642 		fake_prev_il_instruction = NULL;
       
   643 		current_il_instruction   = NULL;
   641 	}
   644 	}
   642 	return NULL;
   645 	return NULL;
   643 }
   646 }
   644 
   647 
   645 
   648 
   935 	/* set the datatype for the operand */
   938 	/* set the datatype for the operand */
   936 	il_operand->datatype = symbol->datatype;
   939 	il_operand->datatype = symbol->datatype;
   937 	il_operand->accept(*this);
   940 	il_operand->accept(*this);
   938 	/* set the desired datatype of the previous il instruction */
   941 	/* set the desired datatype of the previous il instruction */
   939 	set_datatype_in_prev_il_instructions(symbol->datatype, fake_prev_il_instruction);
   942 	set_datatype_in_prev_il_instructions(symbol->datatype, fake_prev_il_instruction);
       
   943 	/* In the case of the ST operator, we must set the datatype of the il_instruction_c object that points to this ST_operator_c ourselves,
       
   944 	 * since the following il_instruction_c objects have not done it, as is normal/standard for other instructions!
       
   945 	 */
       
   946 	current_il_instruction->datatype = symbol->datatype;
   940 	return NULL;
   947 	return NULL;
   941 }
   948 }
   942 
   949 
   943 void *narrow_candidate_datatypes_c::visit(STN_operator_c *symbol) {
   950 void *narrow_candidate_datatypes_c::visit(STN_operator_c *symbol) {
   944 	if (symbol->candidate_datatypes.size() != 1)
   951 	if (symbol->candidate_datatypes.size() != 1)