From: Zoltan Varga Date: Tue, 19 Nov 2013 11:05:04 +0000 (+0100) Subject: [llvm] Implement support for OP_TLS_GET_REG on osx/amd64. X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=3a9ccd06832f28954340754400468f8a7ff1c11f;p=mono.git [llvm] Implement support for OP_TLS_GET_REG on osx/amd64. --- diff --git a/mono/mini/mini-llvm.c b/mono/mini/mini-llvm.c index 0f91727befe..6f9ca9ee2fd 100644 --- a/mono/mini/mini-llvm.c +++ b/mono/mini/mini-llvm.c @@ -3354,6 +3354,22 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) break; } + case OP_TLS_GET_REG: { +#if defined(TARGET_AMD64) && defined(TARGET_OSX) + /* See emit_tls_get_reg () */ + LLVMValueRef base, shifted_offset, offset; + + base = LLVMConstInt (LLVMInt32Type (), mono_amd64_get_tls_gs_offset (), TRUE); + shifted_offset = LLVMBuildMul (builder, convert (ctx, lhs, LLVMInt32Type ()), LLVMConstInt (LLVMInt32Type (), 8, TRUE), ""); + offset = LLVMBuildAdd (builder, base, shifted_offset, ""); + // 256 == GS segment register + LLVMTypeRef ptrtype = LLVMPointerType (IntPtrType (), 256); + values [ins->dreg] = LLVMBuildLoad (builder, LLVMBuildIntToPtr (builder, offset, ptrtype, ""), ""); +#else + LLVM_FAILURE (ctx, "opcode tls-get"); +#endif + break; + } /* * Overflow opcodes.