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 5fe6973..347381f 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 6297515..67c2cfd 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