static LLVMTypeRef
type_to_llvm_type (EmitContext *ctx, MonoType *t)
{
+ if (t->byref)
+ return ThisType ();
+
t = mini_get_underlying_type (t);
switch (t->type) {
int i, pindex;
MonoType *rtype;
- rtype = mini_get_underlying_type (sig->ret);
- ret_type = type_to_llvm_type (ctx, rtype);
+ ret_type = type_to_llvm_type (ctx, sig->ret);
if (!ctx_ok (ctx))
return NULL;
+ rtype = mini_get_underlying_type (sig->ret);
param_types = g_new0 (LLVMTypeRef, (sig->param_count * 8) + 3);
pindex = 0;
if (!cinfo)
return sig_to_llvm_sig_no_cinfo (ctx, sig);
- rtype = mini_get_underlying_type (sig->ret);
- ret_type = type_to_llvm_type (ctx, rtype);
+ ret_type = type_to_llvm_type (ctx, sig->ret);
if (!ctx_ok (ctx))
return NULL;
+ rtype = mini_get_underlying_type (sig->ret);
switch (cinfo->ret.storage) {
case LLVMArgVtypeInReg: