/*
* 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);
}
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;
}