From abfb633968d172c86d6e913d2087406893f4cc71 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 21 Aug 2019 16:43:55 +1000 Subject: [PATCH] gallivm: add support for fences api on older llvm Reviewed-by: Roland Scheidegger --- src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 11 +++++++++++ src/gallium/auxiliary/gallivm/lp_bld_misc.h | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 5fe697346fe..347381f9b32 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -836,3 +836,14 @@ LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, SingleThread ? llvm::SynchronizationScope::SingleThread : llvm::SynchronizationScope::CrossThread)); } #endif + +#if HAVE_LLVM < 0x305 +LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, + LLVMAtomicOrdering ordering, + LLVMBool singleThread, + const char *Name) +{ + return llvm::wrap(llvm::unwrap(B)->CreateFence(mapFromLLVMOrdering(ordering), + singleThread ? llvm::SynchronizationScope::SingleThread : llvm::SynchronizationScope::CrossThread)); +} +#endif diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/src/gallium/auxiliary/gallivm/lp_bld_misc.h index 629751502e7..67c2cfd3fc4 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h @@ -85,6 +85,11 @@ LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMBool SingleThread); #endif +#if HAVE_LLVM < 0x305 +LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, + LLVMAtomicOrdering ordering, + LLVMBool singleThread, const char *Name); +#endif #ifdef __cplusplus } #endif -- 2.30.2