[llvm] Disable the extension of i8/i16 arguments to i32 on arm64, since the ios calli...
authorZoltan Varga <vargaz@gmail.com>
Wed, 29 Oct 2014 16:55:31 +0000 (12:55 -0400)
committerZoltan Varga <vargaz@gmail.com>
Wed, 29 Oct 2014 16:55:31 +0000 (12:55 -0400)
mono/mini/mini-llvm.c

index f3bb3ac33c72cbc311c764335e96b9e2e1fbe1c1..28e76665e16b5a197410e2f8833ed6419092e315 100644 (file)
@@ -420,6 +420,7 @@ type_is_unsigned (EmitContext *ctx, MonoType *t)
        switch (t->type) {
        case MONO_TYPE_U1:
        case MONO_TYPE_U2:
+       case MONO_TYPE_CHAR:
        case MONO_TYPE_U4:
        case MONO_TYPE_U8:
                return TRUE;
@@ -437,7 +438,12 @@ static LLVMTypeRef
 type_to_llvm_arg_type (EmitContext *ctx, MonoType *t)
 {
        LLVMTypeRef ptype = type_to_llvm_type (ctx, t);
-       
+
+       /*
+        * This works on all abis except arm64/ios which passes multiple
+        * arguments in one stack slot.
+        */
+#ifndef TARGET_ARM64
        if (ptype == LLVMInt8Type () || ptype == LLVMInt16Type ()) {
                /* 
                 * LLVM generates code which only sets the lower bits, while JITted
@@ -445,6 +451,7 @@ type_to_llvm_arg_type (EmitContext *ctx, MonoType *t)
                 */
                ptype = LLVMInt32Type ();
        }
+#endif
 
        return ptype;
 }
@@ -1817,7 +1824,7 @@ emit_entry_bb (EmitContext *ctx, LLVMBuilderRef builder)
                                ctx->values [reg] = LLVMBuildLoad (builder, ctx->addresses [reg], "");
                        }
                } else {
-                       ctx->values [reg] = convert (ctx, ctx->values [reg], llvm_type_to_stack_type (type_to_llvm_type (ctx, sig->params [i])));
+                       ctx->values [reg] = convert_full (ctx, ctx->values [reg], llvm_type_to_stack_type (type_to_llvm_type (ctx, sig->params [i])), type_is_unsigned (ctx, sig->params [i]));
                }
        }