stage3/narrow_candidate_datatypes.cc
changeset 443 ff4d26b7e51d
parent 441 e8de43eefcc5
child 444 92d40d2a7adc
equal deleted inserted replaced
442:bd5998ee8876 443:ff4d26b7e51d
    74 		}
    74 		}
    75 	}
    75 	}
    76 	return false;
    76 	return false;
    77 }
    77 }
    78 
    78 
       
    79 /*
       
    80  * All parameters being passed to the called function MUST be in the parameter list to which f_call points to!
       
    81  * This means that, for non formal function calls in IL, de current (default value) must be artificially added to the
       
    82  * beginning of the parameter list BEFORE calling handle_function_call().
       
    83  */
    79 void narrow_candidate_datatypes_c::narrow_nonformal_call(symbol_c *f_call, symbol_c *f_decl, int *ext_parm_count) {
    84 void narrow_candidate_datatypes_c::narrow_nonformal_call(symbol_c *f_call, symbol_c *f_decl, int *ext_parm_count) {
    80 	symbol_c *call_param_value,  *param_type;
    85 	symbol_c *call_param_value,  *param_type;
    81 	identifier_c *param_name;
    86 	identifier_c *param_name;
    82 	function_param_iterator_c       fp_iterator(f_decl);
    87 	function_param_iterator_c       fp_iterator(f_decl);
    83 	function_call_param_iterator_c fcp_iterator(f_call);
    88 	function_call_param_iterator_c fcp_iterator(f_call);
   108 		 */
   113 		 */
   109 		symbol_c *desired_datatype = base_type(fp_iterator.param_type());
   114 		symbol_c *desired_datatype = base_type(fp_iterator.param_type());
   110 		if ((NULL != param_name) && (NULL == desired_datatype)) ERROR;
   115 		if ((NULL != param_name) && (NULL == desired_datatype)) ERROR;
   111 		if ((NULL == param_name) && (NULL != desired_datatype)) ERROR;
   116 		if ((NULL == param_name) && (NULL != desired_datatype)) ERROR;
   112 
   117 
       
   118 		/* NOTE: When we are handling a nonformal function call made from IL, the first parameter is the 'default' or 'current'
       
   119 		 *       il value. However, a pointer to the prev_il_instruction is pre-pended into the operand list (done in fill_candidate_datatypes_c,
       
   120 		 *       and later undone in print_datatypes_error_c - this class is run after the first, and before the latter!), so 
       
   121 		 *       the call 
       
   122 		 *       call_param_value->accept(*this);
       
   123 		 *       may actually be calling an object of the il_instruction_c class.
       
   124 		 *       If that is the case, that same il_instruction_c object will be called again inside the for() loop
       
   125 		 *       of void *narrow_candidate_datatypes_c::visit(instruction_list_c *symbol);
       
   126 		 *       This is actually safe, as the narrow algorithm for all IL instructions is idem-potent.
       
   127 		 *       (It is easier to just let it be called twice than to hack the code to guarantee that it is 
       
   128 		 *       only called once - this would also make this hacked code ugly an un-elegant, so we leave
       
   129 		 *       it as it is for now...)
       
   130 		 */
   113 		set_datatype(desired_datatype, call_param_value);
   131 		set_datatype(desired_datatype, call_param_value);
   114 		call_param_value->accept(*this);
   132 		call_param_value->accept(*this);
   115 
   133 
   116 		if (NULL != param_name) 
   134 		if (NULL != param_name) 
   117 			if (extensible_parameter_highest_index < fp_iterator.extensible_param_index())
   135 			if (extensible_parameter_highest_index < fp_iterator.extensible_param_index())
   263 	symbol->upper_limit->datatype = symbol->datatype;
   281 	symbol->upper_limit->datatype = symbol->datatype;
   264 	symbol->upper_limit->accept(*this);
   282 	symbol->upper_limit->accept(*this);
   265 	return NULL;
   283 	return NULL;
   266 }
   284 }
   267 
   285 
       
   286 /* simple_specification ASSIGN constant */
       
   287 // SYM_REF2(simple_spec_init_c, simple_specification, constant)
       
   288 void *narrow_candidate_datatypes_c::visit(simple_spec_init_c *symbol) {
       
   289 	symbol_c *datatype = base_type(symbol->simple_specification); 
       
   290 	if (NULL != symbol->constant) {
       
   291 		int typeoffset = search_in_datatype_list(datatype, symbol->constant->candidate_datatypes);
       
   292 		if (typeoffset >= 0)
       
   293 			symbol->constant->datatype = symbol->constant->candidate_datatypes[typeoffset];
       
   294 	}
       
   295 	return NULL;
       
   296 }
   268 
   297 
   269 /*********************/
   298 /*********************/
   270 /* B 1.4 - Variables */
   299 /* B 1.4 - Variables */
   271 /*********************/
   300 /*********************/
   272 
   301 
   307 /*********************/
   336 /*********************/
   308 /* B 1.5.1 Functions */
   337 /* B 1.5.1 Functions */
   309 /*********************/
   338 /*********************/
   310 void *narrow_candidate_datatypes_c::visit(function_declaration_c *symbol) {
   339 void *narrow_candidate_datatypes_c::visit(function_declaration_c *symbol) {
   311 	search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
   340 	search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
       
   341 	symbol->var_declarations_list->accept(*this);
   312 	if (debug) printf("Narrowing candidate data types list in body of function %s\n", ((token_c *)(symbol->derived_function_name))->value);
   342 	if (debug) printf("Narrowing candidate data types list in body of function %s\n", ((token_c *)(symbol->derived_function_name))->value);
   313 	prev_il_instruction = NULL;
       
   314 	symbol->function_body->accept(*this);
   343 	symbol->function_body->accept(*this);
   315 	prev_il_instruction = NULL;
       
   316 	delete search_varfb_instance_type;
   344 	delete search_varfb_instance_type;
   317 	search_varfb_instance_type = NULL;
   345 	search_varfb_instance_type = NULL;
   318 	return NULL;
   346 	return NULL;
   319 }
   347 }
   320 
   348 
   321 /***************************/
   349 /***************************/
   322 /* B 1.5.2 Function blocks */
   350 /* B 1.5.2 Function blocks */
   323 /***************************/
   351 /***************************/
   324 void *narrow_candidate_datatypes_c::visit(function_block_declaration_c *symbol) {
   352 void *narrow_candidate_datatypes_c::visit(function_block_declaration_c *symbol) {
   325 	search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
   353 	search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
       
   354 	symbol->var_declarations->accept(*this);
   326 	if (debug) printf("Narrowing candidate data types list in body of FB %s\n", ((token_c *)(symbol->fblock_name))->value);
   355 	if (debug) printf("Narrowing candidate data types list in body of FB %s\n", ((token_c *)(symbol->fblock_name))->value);
   327 	prev_il_instruction = NULL;
       
   328 	symbol->fblock_body->accept(*this);
   356 	symbol->fblock_body->accept(*this);
   329 	prev_il_instruction = NULL;
       
   330 	delete search_varfb_instance_type;
   357 	delete search_varfb_instance_type;
   331 	search_varfb_instance_type = NULL;
   358 	search_varfb_instance_type = NULL;
   332 	return NULL;
   359 	return NULL;
   333 }
   360 }
   334 
   361 
   335 /********************/
   362 /********************/
   336 /* B 1.5.3 Programs */
   363 /* B 1.5.3 Programs */
   337 /********************/
   364 /********************/
   338 void *narrow_candidate_datatypes_c::visit(program_declaration_c *symbol) {
   365 void *narrow_candidate_datatypes_c::visit(program_declaration_c *symbol) {
   339 	search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
   366 	search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
       
   367 	symbol->var_declarations->accept(*this);
   340 	if (debug) printf("Narrowing candidate data types list in body of program %s\n", ((token_c *)(symbol->program_type_name))->value);
   368 	if (debug) printf("Narrowing candidate data types list in body of program %s\n", ((token_c *)(symbol->program_type_name))->value);
   341 	prev_il_instruction = NULL;
       
   342 	symbol->function_block_body->accept(*this);
   369 	symbol->function_block_body->accept(*this);
   343 	prev_il_instruction = NULL;
       
   344 	delete search_varfb_instance_type;
   370 	delete search_varfb_instance_type;
   345 	search_varfb_instance_type = NULL;
   371 	search_varfb_instance_type = NULL;
   346 	return NULL;
   372 	return NULL;
   347 }
   373 }
   348 
   374 
   349 
   375 
   350 /********************************/
   376 /********************************/
   351 /* B 1.7 Configuration elements */
   377 /* B 1.7 Configuration elements */
   352 /********************************/
   378 /********************************/
   353 void *narrow_candidate_datatypes_c::visit(configuration_declaration_c *symbol) {
   379 void *narrow_candidate_datatypes_c::visit(configuration_declaration_c *symbol) {
   354 #if 0
       
   355 	// TODO !!!
   380 	// TODO !!!
   356 	/* for the moment we must return NULL so semantic analysis of remaining code is not interrupted! */
   381 	/* for the moment we must return NULL so semantic analysis of remaining code is not interrupted! */
   357 #endif
       
   358 	return NULL;
   382 	return NULL;
   359 }
   383 }
   360 
   384 
   361 
   385 
   362 /****************************************/
   386 /****************************************/
   363 /* B.2 - Language IL (Instruction List) */
   387 /* B.2 - Language IL (Instruction List) */
   364 /****************************************/
   388 /****************************************/
   365 /***********************************/
   389 /***********************************/
   366 /* B 2.1 Instructions and Operands */
   390 /* B 2.1 Instructions and Operands */
   367 /***********************************/
   391 /***********************************/
       
   392 
       
   393 /*| instruction_list il_instruction */
       
   394 // SYM_LIST(instruction_list_c)
       
   395 void *narrow_candidate_datatypes_c::visit(instruction_list_c *symbol) {
       
   396 	/* We need to go through the instructions backwards, so we can not use the base class' visitor */
       
   397 	for(int i = symbol->n-1; i >= 0; i--) {
       
   398 		symbol->elements[i]->accept(*this);
       
   399 	}
       
   400 	return NULL;
       
   401 }
       
   402 
       
   403 /* | label ':' [il_incomplete_instruction] eol_list */
       
   404 // SYM_REF2(il_instruction_c, label, il_instruction)
       
   405 // void *visit(instruction_list_c *symbol);
       
   406 void *narrow_candidate_datatypes_c::visit(il_instruction_c *symbol) {
       
   407 	if (NULL == symbol->il_instruction)
       
   408 		return NULL;
       
   409 
       
   410 	prev_il_instruction = symbol->prev_il_instruction;
       
   411 	/* Tell the il_instruction the datatype that it must generate - this was chosen by the next il_instruction (we iterate backwards!) */
       
   412 	symbol->il_instruction->datatype = symbol->datatype;
       
   413 	symbol->il_instruction->accept(*this);
       
   414 	return NULL;
       
   415 }
       
   416 
       
   417 
   368 // void *visit(instruction_list_c *symbol);
   418 // void *visit(instruction_list_c *symbol);
   369 void *narrow_candidate_datatypes_c::visit(il_simple_operation_c *symbol) {
   419 void *narrow_candidate_datatypes_c::visit(il_simple_operation_c *symbol) {
       
   420 	/* Tell the il_simple_operator the datatype that it must generate - this was chosen by the next il_instruction (we iterate backwards!) */
       
   421 	symbol->il_simple_operator->datatype = symbol->datatype;
       
   422 	/* recursive call to see whether data types are compatible */
   370 	il_operand = symbol->il_operand;
   423 	il_operand = symbol->il_operand;
   371 	if (NULL != symbol->il_operand) {
       
   372 		symbol->il_operand->accept(*this);
       
   373 	}
       
   374 	/* recursive call to see whether data types are compatible */
       
   375 	symbol->il_simple_operator->accept(*this);
   424 	symbol->il_simple_operator->accept(*this);
   376 	il_operand = NULL;
   425 	il_operand = NULL;
   377 	return NULL;
   426 	return NULL;
   378 }
   427 }
   379 
   428 
   397 	 *
   446 	 *
   398 	 * Since this class is executed after fill_candidate_datatypes_c, and before print_datatypes_error_c,
   447 	 * Since this class is executed after fill_candidate_datatypes_c, and before print_datatypes_error_c,
   399 	 * the following code is actually correct!
   448 	 * the following code is actually correct!
   400 	 */
   449 	 */
   401 	narrow_function_invocation(symbol, fcall_param);
   450 	narrow_function_invocation(symbol, fcall_param);
       
   451 	/* set the desired datatype of the previous il instruction */
       
   452 	prev_il_instruction->datatype = symbol->datatype;
   402 	return NULL;
   453 	return NULL;
   403 }
   454 }
   404 
   455 
   405 /* MJS: Manuele, could you please not delete the following 2 lines of comments. They help me understand where this class is used
   456 /* MJS: Manuele, could you please not delete the following 2 lines of comments. They help me understand where this class is used
   406  *     and when it is created by bison - syntax parse, and how it can show up in the abstract syntax tree.
   457  *     and when it is created by bison - syntax parse, and how it can show up in the abstract syntax tree.
   462 		/* fcall_param.called_function_declaration = */ symbol->called_function_declaration,
   513 		/* fcall_param.called_function_declaration = */ symbol->called_function_declaration,
   463 		/* fcall_param.extensible_param_count      = */ symbol->extensible_param_count
   514 		/* fcall_param.extensible_param_count      = */ symbol->extensible_param_count
   464 	};
   515 	};
   465   
   516   
   466 	narrow_function_invocation(symbol, fcall_param);
   517 	narrow_function_invocation(symbol, fcall_param);
       
   518 	/* set the desired datatype of the previous il instruction */
       
   519 	prev_il_instruction->datatype = symbol->datatype;
   467 	return NULL;
   520 	return NULL;
   468 }
   521 }
   469 
   522 
   470 
   523 
   471 /*
   524 /*
   477  */
   530  */
   478 
   531 
   479 /*******************/
   532 /*******************/
   480 /* B 2.2 Operators */
   533 /* B 2.2 Operators */
   481 /*******************/
   534 /*******************/
   482 void *narrow_candidate_datatypes_c::visit(LD_operator_c *symbol) {
   535 
   483 	prev_il_instruction = symbol;
   536 void *narrow_candidate_datatypes_c::handle_il_instruction(symbol_c *symbol) {
   484 	return NULL;
   537 	if (NULL == symbol->datatype)
   485 }
   538 		/* next IL instructions were unable to determine the datatype this instruction should produce */
   486 
   539 		return NULL;
   487 void *narrow_candidate_datatypes_c::visit(LDN_operator_c *symbol) {
   540 	/* set the datatype for the operand */
       
   541 	il_operand->datatype = symbol->datatype;
       
   542 	il_operand->accept(*this);
       
   543 	/* set the desired datatype of the previous il instruction */
       
   544 	prev_il_instruction->datatype = symbol->datatype;
       
   545 	return NULL;
       
   546 }
       
   547 
       
   548 void *narrow_candidate_datatypes_c::visit(LD_operator_c *symbol)   {
       
   549 	if (NULL == symbol->datatype)
       
   550 		/* next IL instructions were unable to determine the datatype this instruction should produce */
       
   551 		return NULL;
       
   552 	/* set the datatype for the operand */
       
   553 	il_operand->datatype = symbol->datatype;
       
   554 	il_operand->accept(*this);
       
   555 	return NULL;
       
   556 }
       
   557 
       
   558 
       
   559 void *narrow_candidate_datatypes_c::visit(LDN_operator_c *symbol)  {
       
   560 	if (NULL == symbol->datatype)
       
   561 		/* next IL instructions were unable to determine the datatype this instruction should produce */
       
   562 		return NULL;
       
   563 	/* set the datatype for the operand */
       
   564 	il_operand->datatype = symbol->datatype;
       
   565 	il_operand->accept(*this);
       
   566 	return NULL;
       
   567 }
       
   568 
       
   569 void *narrow_candidate_datatypes_c::visit(ST_operator_c *symbol) {
       
   570 	if (debug) printf("narrow_candidate_datatypes_c::visit(ST_operator_c *symbol) called.\n");
   488 	if (symbol->candidate_datatypes.size() != 1)
   571 	if (symbol->candidate_datatypes.size() != 1)
   489 		return NULL;
   572 		return NULL;
   490 	symbol->datatype = symbol->candidate_datatypes[0];
   573 	symbol->datatype = symbol->candidate_datatypes[0];
       
   574 	/* set the datatype for the operand */
   491 	il_operand->datatype = symbol->datatype;
   575 	il_operand->datatype = symbol->datatype;
   492 	il_operand->accept(*this);
   576 	il_operand->accept(*this);
   493 	prev_il_instruction = symbol;
   577 	/* set the desired datatype of the previous il instruction */
   494 	return NULL;
   578 	prev_il_instruction->datatype = symbol->datatype;
   495 }
   579 	if (debug) printf("narrow_candidate_datatypes_c::visit(ST_operator_c *symbol) returning. previous_il_instruction->datatype = %p\n", prev_il_instruction->datatype);
   496 
       
   497 void *narrow_candidate_datatypes_c::visit(ST_operator_c *symbol) {
       
   498 	if (symbol->candidate_datatypes.size() != 1)
       
   499 		return NULL;
       
   500 	symbol->datatype = symbol->candidate_datatypes[0];
       
   501 	il_operand->datatype = symbol->datatype;
       
   502 	il_operand->accept(*this);
       
   503 	prev_il_instruction = symbol;
       
   504 	return NULL;
   580 	return NULL;
   505 }
   581 }
   506 
   582 
   507 void *narrow_candidate_datatypes_c::visit(STN_operator_c *symbol) {
   583 void *narrow_candidate_datatypes_c::visit(STN_operator_c *symbol) {
   508 	if (symbol->candidate_datatypes.size() != 1)
   584 	if (symbol->candidate_datatypes.size() != 1)
   509 		return NULL;
   585 		return NULL;
   510 	symbol->datatype = symbol->candidate_datatypes[0];
   586 	symbol->datatype = symbol->candidate_datatypes[0];
       
   587 	/* set the datatype for the operand */
   511 	il_operand->datatype = symbol->datatype;
   588 	il_operand->datatype = symbol->datatype;
   512 	il_operand->accept(*this);
   589 	il_operand->accept(*this);
   513 	prev_il_instruction = symbol;
   590 	/* set the desired datatype of the previous il instruction */
       
   591 	prev_il_instruction->datatype = symbol->datatype;
   514 	return NULL;
   592 	return NULL;
   515 }
   593 }
   516 
   594 
   517 void *narrow_candidate_datatypes_c::visit(NOT_operator_c *symbol) {
   595 void *narrow_candidate_datatypes_c::visit(NOT_operator_c *symbol) {
   518 	prev_il_instruction = symbol;
   596 	prev_il_instruction = symbol;
   519 	return NULL;
   597 	return NULL;
   520 }
   598 }
   521 
   599 
   522 void *narrow_candidate_datatypes_c::visit(S_operator_c *symbol) {
   600 void *narrow_candidate_datatypes_c::visit(S_operator_c *symbol)  {return handle_il_instruction(symbol);}
   523 	if (symbol->candidate_datatypes.size() != 1)
   601 void *narrow_candidate_datatypes_c::visit(R_operator_c *symbol)  {return handle_il_instruction(symbol);}
   524 		return NULL;
   602 void *narrow_candidate_datatypes_c::visit(S1_operator_c *symbol) {return handle_il_instruction(symbol);}
   525 	symbol->datatype = symbol->candidate_datatypes[0];
   603 void *narrow_candidate_datatypes_c::visit(R1_operator_c *symbol) {return handle_il_instruction(symbol);}
   526 	il_operand->datatype = symbol->datatype;
       
   527 	il_operand->accept(*this);
       
   528 	prev_il_instruction = symbol;
       
   529 	return NULL;
       
   530 }
       
   531 
       
   532 void *narrow_candidate_datatypes_c::visit(R_operator_c *symbol) {
       
   533 	if (symbol->candidate_datatypes.size() != 1)
       
   534 		return NULL;
       
   535 	symbol->datatype = symbol->candidate_datatypes[0];
       
   536 	il_operand->datatype = symbol->datatype;
       
   537 	il_operand->accept(*this);
       
   538 	prev_il_instruction = symbol;
       
   539 	return NULL;
       
   540 }
       
   541 
       
   542 void *narrow_candidate_datatypes_c::visit(S1_operator_c *symbol) {
       
   543 	if (symbol->candidate_datatypes.size() != 1)
       
   544 		return NULL;
       
   545 	symbol->datatype = symbol->candidate_datatypes[0];
       
   546 	il_operand->datatype = symbol->datatype;
       
   547 	il_operand->accept(*this);
       
   548 	prev_il_instruction = symbol;
       
   549 	return NULL;
       
   550 }
       
   551 
       
   552 void *narrow_candidate_datatypes_c::visit(R1_operator_c *symbol) {
       
   553 	if (symbol->candidate_datatypes.size() != 1)
       
   554 		return NULL;
       
   555 	symbol->datatype = symbol->candidate_datatypes[0];
       
   556 	il_operand->datatype = symbol->datatype;
       
   557 	il_operand->accept(*this);
       
   558 	prev_il_instruction = symbol;
       
   559 	return NULL;
       
   560 }
       
   561 
   604 
   562 void *narrow_candidate_datatypes_c::visit(CLK_operator_c *symbol) {
   605 void *narrow_candidate_datatypes_c::visit(CLK_operator_c *symbol) {
   563 	prev_il_instruction = symbol;
       
   564 	return NULL;
   606 	return NULL;
   565 }
   607 }
   566 
   608 
   567 void *narrow_candidate_datatypes_c::visit(CU_operator_c *symbol) {
   609 void *narrow_candidate_datatypes_c::visit(CU_operator_c *symbol) {
   568 	prev_il_instruction = symbol;
       
   569 	return NULL;
   610 	return NULL;
   570 }
   611 }
   571 
   612 
   572 void *narrow_candidate_datatypes_c::visit(CD_operator_c *symbol) {
   613 void *narrow_candidate_datatypes_c::visit(CD_operator_c *symbol) {
   573 	prev_il_instruction = symbol;
       
   574 	return NULL;
   614 	return NULL;
   575 }
   615 }
   576 
   616 
   577 void *narrow_candidate_datatypes_c::visit(PV_operator_c *symbol) {
   617 void *narrow_candidate_datatypes_c::visit(PV_operator_c *symbol) {
   578 	prev_il_instruction = symbol;
       
   579 	return NULL;
   618 	return NULL;
   580 }
   619 }
   581 
   620 
   582 void *narrow_candidate_datatypes_c::visit(IN_operator_c *symbol) {
   621 void *narrow_candidate_datatypes_c::visit(IN_operator_c *symbol) {
   583 	prev_il_instruction = symbol;
       
   584 	return NULL;
   622 	return NULL;
   585 }
   623 }
   586 
   624 
   587 void *narrow_candidate_datatypes_c::visit(PT_operator_c *symbol) {
   625 void *narrow_candidate_datatypes_c::visit(PT_operator_c *symbol) {
   588 	prev_il_instruction = symbol;
   626 	return NULL;
   589 	return NULL;
   627 }
   590 }
   628 
   591 
   629 void *narrow_candidate_datatypes_c::visit(AND_operator_c *symbol)  {return handle_il_instruction(symbol);}
   592 void *narrow_candidate_datatypes_c::visit(AND_operator_c *symbol) {
   630 void *narrow_candidate_datatypes_c::visit(OR_operator_c *symbol)  {return handle_il_instruction(symbol);}
   593 	if (symbol->candidate_datatypes.size() != 1)
   631 void *narrow_candidate_datatypes_c::visit(XOR_operator_c *symbol)  {return handle_il_instruction(symbol);}
   594 		return NULL;
   632 void *narrow_candidate_datatypes_c::visit(ANDN_operator_c *symbol)  {return handle_il_instruction(symbol);}
   595 	symbol->datatype = symbol->candidate_datatypes[0];
   633 void *narrow_candidate_datatypes_c::visit(ORN_operator_c *symbol)  {return handle_il_instruction(symbol);}
   596 	il_operand->datatype = symbol->datatype;
   634 void *narrow_candidate_datatypes_c::visit(XORN_operator_c *symbol)  {return handle_il_instruction(symbol);}
   597 	il_operand->accept(*this);
   635 void *narrow_candidate_datatypes_c::visit(ADD_operator_c *symbol)  {return handle_il_instruction(symbol);}
   598 	prev_il_instruction = symbol;
   636 void *narrow_candidate_datatypes_c::visit(SUB_operator_c *symbol)  {return handle_il_instruction(symbol);}
   599 	return NULL;
   637 void *narrow_candidate_datatypes_c::visit(MUL_operator_c *symbol)  {return handle_il_instruction(symbol);}
   600 }
   638 void *narrow_candidate_datatypes_c::visit(DIV_operator_c *symbol)  {return handle_il_instruction(symbol);}
   601 
   639 void *narrow_candidate_datatypes_c::visit(MOD_operator_c *symbol)  {return handle_il_instruction(symbol);}
   602 void *narrow_candidate_datatypes_c::visit(OR_operator_c *symbol) {
   640 void *narrow_candidate_datatypes_c::visit(GT_operator_c *symbol)  {return handle_il_instruction(symbol);}
   603 	if (symbol->candidate_datatypes.size() != 1)
   641 void *narrow_candidate_datatypes_c::visit(GE_operator_c *symbol)  {return handle_il_instruction(symbol);}
   604 		return NULL;
   642 void *narrow_candidate_datatypes_c::visit(EQ_operator_c *symbol)  {return handle_il_instruction(symbol);}
   605 	symbol->datatype = symbol->candidate_datatypes[0];
   643 void *narrow_candidate_datatypes_c::visit(LT_operator_c *symbol)  {return handle_il_instruction(symbol);}
   606 	il_operand->datatype = symbol->datatype;
   644 void *narrow_candidate_datatypes_c::visit(LE_operator_c *symbol)  {return handle_il_instruction(symbol);}
   607 	il_operand->accept(*this);
   645 void *narrow_candidate_datatypes_c::visit(NE_operator_c *symbol)  {return handle_il_instruction(symbol);}
   608 	prev_il_instruction = symbol;
       
   609 	return NULL;
       
   610 }
       
   611 
       
   612 void *narrow_candidate_datatypes_c::visit(XOR_operator_c *symbol) {
       
   613 	if (symbol->candidate_datatypes.size() != 1)
       
   614 		return NULL;
       
   615 	symbol->datatype = symbol->candidate_datatypes[0];
       
   616 	il_operand->datatype = symbol->datatype;
       
   617 	il_operand->accept(*this);
       
   618 	prev_il_instruction = symbol;
       
   619 	return NULL;
       
   620 }
       
   621 
       
   622 void *narrow_candidate_datatypes_c::visit(ANDN_operator_c *symbol) {
       
   623 	if (symbol->candidate_datatypes.size() != 1)
       
   624 		return NULL;
       
   625 	symbol->datatype = symbol->candidate_datatypes[0];
       
   626 	il_operand->datatype = symbol->datatype;
       
   627 	il_operand->accept(*this);
       
   628 	prev_il_instruction = symbol;
       
   629 	return NULL;
       
   630 }
       
   631 
       
   632 void *narrow_candidate_datatypes_c::visit(ORN_operator_c *symbol) {
       
   633 	if (symbol->candidate_datatypes.size() != 1)
       
   634 		return NULL;
       
   635 	symbol->datatype = symbol->candidate_datatypes[0];
       
   636 	il_operand->datatype = symbol->datatype;
       
   637 	il_operand->accept(*this);
       
   638 	prev_il_instruction = symbol;
       
   639 	return NULL;
       
   640 }
       
   641 
       
   642 void *narrow_candidate_datatypes_c::visit(XORN_operator_c *symbol) {
       
   643 	if (symbol->candidate_datatypes.size() != 1)
       
   644 		return NULL;
       
   645 	symbol->datatype = symbol->candidate_datatypes[0];
       
   646 	il_operand->datatype = symbol->datatype;
       
   647 	il_operand->accept(*this);
       
   648 	prev_il_instruction = symbol;
       
   649 	return NULL;
       
   650 }
       
   651 
       
   652 void *narrow_candidate_datatypes_c::visit(ADD_operator_c *symbol) {
       
   653 	prev_il_instruction = symbol;
       
   654 	return NULL;
       
   655 }
       
   656 
       
   657 void *narrow_candidate_datatypes_c::visit(SUB_operator_c *symbol) {
       
   658 	prev_il_instruction = symbol;
       
   659 	return NULL;
       
   660 }
       
   661 
       
   662 void *narrow_candidate_datatypes_c::visit(MUL_operator_c *symbol) {
       
   663 	prev_il_instruction = symbol;
       
   664 	return NULL;
       
   665 }
       
   666 
       
   667 void *narrow_candidate_datatypes_c::visit(DIV_operator_c *symbol) {
       
   668 	prev_il_instruction = symbol;
       
   669 	return NULL;
       
   670 }
       
   671 
       
   672 void *narrow_candidate_datatypes_c::visit(MOD_operator_c *symbol) {
       
   673 	prev_il_instruction = symbol;
       
   674 	return NULL;
       
   675 }
       
   676 
       
   677 void *narrow_candidate_datatypes_c::visit(GT_operator_c *symbol) {
       
   678 	prev_il_instruction = symbol;
       
   679 	return NULL;
       
   680 }
       
   681 
       
   682 void *narrow_candidate_datatypes_c::visit(GE_operator_c *symbol) {
       
   683 	prev_il_instruction = symbol;
       
   684 	return NULL;
       
   685 }
       
   686 
       
   687 void *narrow_candidate_datatypes_c::visit(EQ_operator_c *symbol) {
       
   688 	prev_il_instruction = symbol;
       
   689 	return NULL;
       
   690 }
       
   691 
       
   692 void *narrow_candidate_datatypes_c::visit(LT_operator_c *symbol) {
       
   693 	prev_il_instruction = symbol;
       
   694 	return NULL;
       
   695 }
       
   696 
       
   697 void *narrow_candidate_datatypes_c::visit(LE_operator_c *symbol) {
       
   698 	prev_il_instruction = symbol;
       
   699 	return NULL;
       
   700 }
       
   701 
       
   702 void *narrow_candidate_datatypes_c::visit(NE_operator_c *symbol) {
       
   703 	prev_il_instruction = symbol;
       
   704 	return NULL;
       
   705 }
       
   706 
   646 
   707 void *narrow_candidate_datatypes_c::visit(CAL_operator_c *symbol) {
   647 void *narrow_candidate_datatypes_c::visit(CAL_operator_c *symbol) {
   708 	prev_il_instruction = symbol;
       
   709 	return NULL;
   648 	return NULL;
   710 }
   649 }
   711 
   650 
   712 void *narrow_candidate_datatypes_c::visit(CALC_operator_c *symbol) {
   651 void *narrow_candidate_datatypes_c::visit(CALC_operator_c *symbol) {
   713 	prev_il_instruction = symbol;
       
   714 	return NULL;
   652 	return NULL;
   715 }
   653 }
   716 
   654 
   717 void *narrow_candidate_datatypes_c::visit(CALCN_operator_c *symbol) {
   655 void *narrow_candidate_datatypes_c::visit(CALCN_operator_c *symbol) {
   718 	prev_il_instruction = symbol;
       
   719 	return NULL;
   656 	return NULL;
   720 }
   657 }
   721 
   658 
   722 void *narrow_candidate_datatypes_c::visit(RET_operator_c *symbol) {
   659 void *narrow_candidate_datatypes_c::visit(RET_operator_c *symbol) {
   723 	prev_il_instruction = symbol;
       
   724 	return NULL;
   660 	return NULL;
   725 }
   661 }
   726 
   662 
   727 void *narrow_candidate_datatypes_c::visit(RETC_operator_c *symbol) {
   663 void *narrow_candidate_datatypes_c::visit(RETC_operator_c *symbol) {
   728 	prev_il_instruction = symbol;
       
   729 	return NULL;
   664 	return NULL;
   730 }
   665 }
   731 
   666 
   732 void *narrow_candidate_datatypes_c::visit(RETCN_operator_c *symbol) {
   667 void *narrow_candidate_datatypes_c::visit(RETCN_operator_c *symbol) {
   733 	prev_il_instruction = symbol;
       
   734 	return NULL;
   668 	return NULL;
   735 }
   669 }
   736 
   670 
   737 void *narrow_candidate_datatypes_c::visit(JMP_operator_c *symbol) {
   671 void *narrow_candidate_datatypes_c::visit(JMP_operator_c *symbol) {
   738 	prev_il_instruction = symbol;
       
   739 	return NULL;
   672 	return NULL;
   740 }
   673 }
   741 
   674 
   742 void *narrow_candidate_datatypes_c::visit(JMPC_operator_c *symbol) {
   675 void *narrow_candidate_datatypes_c::visit(JMPC_operator_c *symbol) {
   743 	prev_il_instruction = symbol;
       
   744 	return NULL;
   676 	return NULL;
   745 }
   677 }
   746 
   678 
   747 void *narrow_candidate_datatypes_c::visit(JMPCN_operator_c *symbol) {
   679 void *narrow_candidate_datatypes_c::visit(JMPCN_operator_c *symbol) {
   748 	prev_il_instruction = symbol;
       
   749 	return NULL;
   680 	return NULL;
   750 }
   681 }
   751 
   682 
   752 /* Symbol class handled together with function call checks */
   683 /* Symbol class handled together with function call checks */
   753 // void *visit(il_assign_operator_c *symbol, variable_name);
   684 // void *visit(il_assign_operator_c *symbol, variable_name);