[Openmp-commits] [PATCH] D11301: Remove the __kmp_invoke_microtask() that relies on libffi
Jonathan Peyton
jonathan.l.peyton at intel.com
Fri Jul 17 09:22:22 PDT 2015
jlpeyton created this revision.
jlpeyton added a reviewer: hfinkel.
jlpeyton added subscribers: openmp-commits, carlo.bertolli, cbergstrom.
jlpeyton set the repository for this revision to rL LLVM.
Herald added a subscriber: aemerson.
The first port of the library to a non-x86 architecture (ARM) introduced a __kmp_invoke_microtask() function which relied on libffi. Two architecture ports after that (aarch64 and ppc64) rely on yet another __kmp_invoke_microtask(). I've rearranged the MACRO logic to say "If this isn't an x86 or MIC architecture, then use the __kmp_invoke_microtask() that doesn't use libffi". This also makes the library just a little more port friendly for possible future architecture ports and gets rid of a duplicate __kmp_invoke_microtask() that is easily replaced by another existing __kmp_invoke_microtask().
Because I don't have access to non-x86 architectures, this patch should be tested by external users if possible although it isn't very invasive.
Repository:
rL LLVM
http://reviews.llvm.org/D11301
Files:
runtime/src/z_Linux_util.c
Index: runtime/src/z_Linux_util.c
===================================================================
--- runtime/src/z_Linux_util.c
+++ runtime/src/z_Linux_util.c
@@ -60,12 +60,6 @@
#include <ctype.h>
#include <fcntl.h>
-// For non-x86 architecture
-#if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64)
-# include <stdbool.h>
-# include <ffi.h>
-#endif
-
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
@@ -2615,55 +2609,7 @@
#endif // USE_LOAD_BALANCE
-
-#if KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64)
-
-int __kmp_invoke_microtask( microtask_t pkfn, int gtid, int tid, int argc,
- void *p_argv[]
-#if OMPT_SUPPORT
- , void **exit_frame_ptr
-#endif
-)
-{
- int argc_full = argc + 2;
- int i;
- ffi_cif cif;
- ffi_type *types[argc_full];
- void *args[argc_full];
- void *idp[2];
-
-#if OMPT_SUPPORT
- *exit_frame_ptr = __builtin_frame_address(0);
-#endif
- /* We're only passing pointers to the target. */
- for (i = 0; i < argc_full; i++)
- types[i] = &ffi_type_pointer;
-
- /* Ugly double-indirection, but that's how it goes... */
- idp[0] = >id;
- idp[1] = &tid;
- args[0] = &idp[0];
- args[1] = &idp[1];
-
- for (i = 0; i < argc; i++)
- args[2 + i] = &p_argv[i];
-
- if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, argc_full,
- &ffi_type_void, types) != FFI_OK)
- abort();
-
- ffi_call(&cif, (void (*)(void))pkfn, NULL, args);
-
-#if OMPT_SUPPORT
- *exit_frame_ptr = 0;
-#endif
-
- return 1;
-}
-
-#endif // KMP_COMPILER_GCC && !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_PPC64)
-
-#if KMP_ARCH_PPC64 || KMP_ARCH_AARCH64
+#if !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_MIC)
// we really only need the case with 1 argument, because CLANG always build
// a struct of pointers to shared variables referenced in the outlined function
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11301.30008.patch
Type: text/x-patch
Size: 2058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20150717/dbea41d0/attachment.bin>
More information about the Openmp-commits
mailing list