gallivm: add support for fences api on older llvm
authorDave Airlie <airlied@redhat.com>
Wed, 21 Aug 2019 06:43:55 +0000 (16:43 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 27 Aug 2019 02:30:10 +0000 (12:30 +1000)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
src/gallium/auxiliary/gallivm/lp_bld_misc.h

index 5fe697346fe2dd0b50d0c81719592a0019bc9e11..347381f9b32b3015f3db6ad6e9e8197347edd09a 100644 (file)
@@ -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
index 629751502e796bc2c85d4f4104152a77397a3d83..67c2cfd3fc45423ec7243b1deb4570ada1b31f60 100644 (file)
@@ -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