gallivm: Use standard LLVMSetAlignment from LLVM 3.4 onwards.
[mesa.git] / src / gallium / auxiliary / gallivm / lp_bld.h
index ee05c6ba01d999ea271718dabc03d82d033c8ff8..239c27e3c255dc8ab51dc2557947c56fdac81d9a 100644 (file)
 #ifndef HAVE_LLVM
 #error "HAVE_LLVM should be set with LLVM's version number, e.g. (0x0207 for 2.7)"
 #endif
+#if HAVE_LLVM < 0x303
+#error "LLVM 3.3 or newer required"
+#endif
+
+
+#if HAVE_LLVM <= 0x0303
+/* We won't actually use LLVMMCJITMemoryManagerRef, just create a dummy
+ * typedef to simplify things elsewhere.
+ */
+typedef void *LLVMMCJITMemoryManagerRef;
+#endif
 
 
 /**
 #define LLVMInsertBasicBlock ILLEGAL_LLVM_FUNCTION
 #define LLVMCreateBuilder ILLEGAL_LLVM_FUNCTION
 
+
+/*
+ * Before LLVM 3.4 LLVMSetAlignment only supported GlobalValue, not
+ * LoadInst/StoreInst as we need.
+ */
+#if HAVE_LLVM < 0x0304
+#  ifdef __cplusplus
+      extern "C"
+#  endif
+   void LLVMSetAlignmentBackport(LLVMValueRef V, unsigned Bytes);
+#  define LLVMSetAlignment LLVMSetAlignmentBackport
+#endif
+
+
 #endif /* LP_BLD_H */