X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fmini-llvm.c;h=adec297e3c3ebfaff926f66a07fea1c05851de76;hb=56ad8f4e5dfb8198e4671f631a3103b1e8b83dd3;hp=558db05357e9a8a6085d952badbdbb1b470e6339;hpb=1e764e5c292c6af5c4ac5f6f6235725813e98fd3;p=mono.git diff --git a/mono/mini/mini-llvm.c b/mono/mini/mini-llvm.c index 558db05357e..adec297e3c3 100644 --- a/mono/mini/mini-llvm.c +++ b/mono/mini/mini-llvm.c @@ -3,6 +3,7 @@ * * Copyright 2009-2011 Novell Inc (http://www.novell.com) * Copyright 2011 Xamarin Inc (http://www.xamarin.com) + * Licensed under the MIT license. See LICENSE file in the project root for full license information. */ #include "mini.h" @@ -2068,6 +2069,11 @@ emit_cond_system_exception (EmitContext *ctx, MonoBasicBlock *bb, const char *ex MonoClass *exc_class; LLVMValueRef args [2]; LLVMValueRef callee; + gboolean no_pc = FALSE; + + if (IS_TARGET_AMD64) + /* Some platforms don't require the pc argument */ + no_pc = TRUE; ex_bb = gen_bb (ctx, "EX_BB"); if (ctx->llvm_only) @@ -2112,7 +2118,10 @@ emit_cond_system_exception (EmitContext *ctx, MonoBasicBlock *bb, const char *ex LLVMTypeRef sig; const char *icall_name; - sig = LLVMFunctionType2 (LLVMVoidType (), LLVMInt32Type (), LLVMPointerType (LLVMInt8Type (), 0), FALSE); + if (no_pc) + sig = LLVMFunctionType1 (LLVMVoidType (), LLVMInt32Type (), FALSE); + else + sig = LLVMFunctionType2 (LLVMVoidType (), LLVMInt32Type (), LLVMPointerType (LLVMInt8Type (), 0), FALSE); icall_name = "llvm_throw_corlib_exception_abs_trampoline"; if (ctx->cfg->compile_aot) { @@ -2144,17 +2153,18 @@ emit_cond_system_exception (EmitContext *ctx, MonoBasicBlock *bb, const char *ex } } - if (IS_TARGET_X86 || IS_TARGET_AMD64) - args [0] = LLVMConstInt (LLVMInt32Type (), exc_class->type_token - MONO_TOKEN_TYPE_DEF, FALSE); - else - args [0] = LLVMConstInt (LLVMInt32Type (), exc_class->type_token, FALSE); + args [0] = LLVMConstInt (LLVMInt32Type (), exc_class->type_token - MONO_TOKEN_TYPE_DEF, FALSE); /* * The LLVM mono branch contains changes so a block address can be passed as an * argument to a call. */ - args [1] = LLVMBlockAddress (ctx->lmethod, ex_bb); - emit_call (ctx, bb, &builder, callee, args, 2); + if (no_pc) { + emit_call (ctx, bb, &builder, callee, args, 1); + } else { + args [1] = LLVMBlockAddress (ctx->lmethod, ex_bb); + emit_call (ctx, bb, &builder, callee, args, 2); + } LLVMBuildUnreachable (builder);