/// int __isoc99_sscanf(const char *s, const char *format, ...)
TLI_DEFINE_ENUM_INTERNAL(dunder_isoc99_sscanf)
TLI_DEFINE_STRING_INTERNAL("__isoc99_sscanf")
+/// void __kmpc_alloc_shared(size_t nbyte);
+TLI_DEFINE_ENUM_INTERNAL(__kmpc_alloc_shared)
+TLI_DEFINE_STRING_INTERNAL("__kmpc_alloc_shared")
+/// void __kmpc_free_shared(void *ptr);
+TLI_DEFINE_ENUM_INTERNAL(__kmpc_free_shared)
+TLI_DEFINE_STRING_INTERNAL("__kmpc_free_shared")
/// double __log10_finite(double x);
TLI_DEFINE_ENUM_INTERNAL(log10_finite)
TLI_DEFINE_STRING_INTERNAL("__log10_finite")
{LibFunc_vec_realloc, {ReallocLike, 2, 1, -1}},
{LibFunc_reallocf, {ReallocLike, 2, 1, -1}},
{LibFunc_strdup, {StrDupLike, 1, -1, -1}},
- {LibFunc_strndup, {StrDupLike, 2, 1, -1}}
+ {LibFunc_strndup, {StrDupLike, 2, 1, -1}},
+ {LibFunc___kmpc_alloc_shared, {MallocLike, 1, 0, -1}}
// TODO: Handle "int posix_memalign(void **, size_t, size_t)"
};
bool llvm::isLibFreeFunction(const Function *F, const LibFunc TLIFn) {
unsigned ExpectedNumParams;
if (TLIFn == LibFunc_free ||
+ TLIFn == LibFunc___kmpc_free_shared || // OpenMP Offloading RTL free
TLIFn == LibFunc_ZdlPv || // operator delete(void*)
TLIFn == LibFunc_ZdaPv || // operator delete[](void*)
TLIFn == LibFunc_msvc_delete_ptr32 || // operator delete(void*)
TLI.setUnavailable(LibFunc_memcpy);
TLI.setUnavailable(LibFunc_memset);
TLI.setUnavailable(LibFunc_memset_pattern16);
+ TLI.setAvailable(llvm::LibFunc___kmpc_alloc_shared);
+ TLI.setAvailable(llvm::LibFunc___kmpc_free_shared);
return;
}
// TLI.setAvailable(llvm::LibFunc_memcpy);
// TLI.setAvailable(llvm::LibFunc_memset);
+ TLI.setAvailable(llvm::LibFunc___kmpc_alloc_shared);
+ TLI.setAvailable(llvm::LibFunc___kmpc_free_shared);
} else {
TLI.setUnavailable(LibFunc_nvvm_reflect);
}
FTy.getParamType(2)->isPointerTy());
case LibFunc_system:
return (NumParams == 1 && FTy.getParamType(0)->isPointerTy());
+ case LibFunc___kmpc_alloc_shared:
case LibFunc_malloc:
case LibFunc_vec_malloc:
return (NumParams == 1 && FTy.getReturnType()->isPointerTy());
case LibFunc_mktime:
case LibFunc_times:
case LibFunc_vec_free:
+ case LibFunc___kmpc_free_shared:
return (NumParams != 0 && FTy.getParamType(0)->isPointerTy());
case LibFunc_fopen:
"declare i8* @vec_malloc(i64)\n"
"declare i8* @vec_realloc(i8*, i64)\n"
"declare void @vec_free(i8*)\n"
+
+ // These functions are OpenMP Offloading allocation / free routines
+ "declare i8* @__kmpc_alloc_shared(i64)\n"
+ "declare void @__kmpc_free_shared(i8*)\n"
);
for (unsigned FI = 0; FI != LibFunc::NumLibFuncs; ++FI) {