/*
* Convert a local/arg to the type needed on the stack.
* Returns the converted value when conversion is needed or value as it is.
*/
static ILJitValue ConvertToStack(ILJITCoder *coder, ILJitValue value)
{
ILJitType type = jit_value_get_type(value);
ILJitType newType = jit_type_promote_int(type);
if(type != newType)
{
return jit_insn_convert(coder->jitFunction, value, newType, 0);
}
ILJITCoder *jitCoder = _ILCoderToILJITCoder(coder);
// we need paramno + 1 because the zero argument is ILExecThread which is added as param 0
jit_value_t param = jit_value_get_param(jitCoder->function, argNum + 1);
jit_type_t paramType = ILJitGetTypes(type, argNum + 1);
paramType = jit_type_promote_int (paramType);
int typeKind = jit_type_get_kind(paramType);
if(typeKind==JIT_TYPE_FLOAT32 || typeKind==JIT_TYPE_FLOAT32 || typeKind==JIT_TYPE_NFLOAT)
{
}
if((type == _IL_JIT_TYPE_SINGLE) || (type == _IL_JIT_TYPE_DOUBLE))
{
return jit_insn_convert(coder->jitFunction, value, _IL_JIT_TYPE_NFLOAT, 0);
}
return value;
}