stage3/narrow_candidate_datatypes.cc
changeset 839 99d9ef4d210b
parent 838 13ea7c080018
child 843 f9a059c24aea
equal deleted inserted replaced
838:13ea7c080018 839:99d9ef4d210b
  1241 	return NULL;
  1241 	return NULL;
  1242 }
  1242 }
  1243 
  1243 
  1244 
  1244 
  1245 
  1245 
  1246 
  1246 void *narrow_candidate_datatypes_c::narrow_store_operator(symbol_c *symbol) {
  1247 void *narrow_candidate_datatypes_c::visit( LD_operator_c *symbol)  {return set_il_operand_datatype(il_operand, symbol->datatype);}
       
  1248 void *narrow_candidate_datatypes_c::visit(LDN_operator_c *symbol)  {return set_il_operand_datatype(il_operand, symbol->datatype);}
       
  1249 
       
  1250 void *narrow_candidate_datatypes_c::visit(ST_operator_c *symbol) {
       
  1251 	if (symbol->candidate_datatypes.size() == 1) {
  1247 	if (symbol->candidate_datatypes.size() == 1) {
  1252 		symbol->datatype = symbol->candidate_datatypes[0];
  1248 		symbol->datatype = symbol->candidate_datatypes[0];
  1253 		/* set the desired datatype of the previous il instruction */
  1249 		/* set the desired datatype of the previous il instruction */
  1254 		set_datatype_in_prev_il_instructions(symbol->datatype, fake_prev_il_instruction);
  1250 		set_datatype_in_prev_il_instructions(symbol->datatype, fake_prev_il_instruction);
  1255 		/* 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,
  1251 		/* 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,
  1261 	/* set the datatype for the operand */
  1257 	/* set the datatype for the operand */
  1262 	set_il_operand_datatype(il_operand, symbol->datatype);
  1258 	set_il_operand_datatype(il_operand, symbol->datatype);
  1263 	return NULL;
  1259 	return NULL;
  1264 }
  1260 }
  1265 
  1261 
  1266 void *narrow_candidate_datatypes_c::visit(STN_operator_c *symbol) {
  1262 
  1267 	if (symbol->candidate_datatypes.size() == 1) {
  1263 
  1268 		symbol->datatype = symbol->candidate_datatypes[0];
  1264 void *narrow_candidate_datatypes_c::visit(  LD_operator_c *symbol)  {return set_il_operand_datatype(il_operand, symbol->datatype);}
  1269 		/* set the desired datatype of the previous il instruction */
  1265 void *narrow_candidate_datatypes_c::visit( LDN_operator_c *symbol)  {return set_il_operand_datatype(il_operand, symbol->datatype);}
  1270 		set_datatype_in_prev_il_instructions(symbol->datatype, fake_prev_il_instruction);
  1266 
  1271 		/* 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,
  1267 void *narrow_candidate_datatypes_c::visit(  ST_operator_c *symbol)  {return narrow_store_operator(symbol);}
  1272 		 * since the following il_instruction_c objects have not done it, as is normal/standard for other instructions!
  1268 void *narrow_candidate_datatypes_c::visit( STN_operator_c *symbol)  {return narrow_store_operator(symbol);}
  1273 		 */
       
  1274 		current_il_instruction->datatype = symbol->datatype;
       
  1275 	}
       
  1276 	
       
  1277 	/* set the datatype for the operand */
       
  1278 	set_il_operand_datatype(il_operand, symbol->datatype);
       
  1279 	return NULL;
       
  1280 }
       
  1281 
       
  1282 
  1269 
  1283 
  1270 
  1284 /* NOTE: the standard allows syntax in which the NOT operator is followed by an optional <il_operand>
  1271 /* NOTE: the standard allows syntax in which the NOT operator is followed by an optional <il_operand>
  1285  *              NOT [<il_operand>]
  1272  *              NOT [<il_operand>]
  1286  *       However, it does not define the semantic of the NOT operation when the <il_operand> is specified.
  1273  *       However, it does not define the semantic of the NOT operation when the <il_operand> is specified.