diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2016-04-02 14:31:16 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-04-03 09:51:27 +0100 |
commit | bcfb86b09de3bfc9c7cdf6925658b5e529a8fc62 (patch) | |
tree | 3609f16a54701d648f10beba4b7b0450300e6f0d /src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | |
parent | 6d54096fa6cde0ebc7da29468071fe2c34aec0cf (diff) | |
download | external_mesa3d-bcfb86b09de3bfc9c7cdf6925658b5e529a8fc62.zip external_mesa3d-bcfb86b09de3bfc9c7cdf6925658b5e529a8fc62.tar.gz external_mesa3d-bcfb86b09de3bfc9c7cdf6925658b5e529a8fc62.tar.bz2 |
gallivm: Use standard LLVMSetAlignment from LLVM 3.4 onwards.
Only provide a fallback for LLVM 3.3.
One less dependency on LLVM C++ interface.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_misc.cpp')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 30ef37c..61a50fa 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -187,22 +187,28 @@ lp_build_load_volatile(LLVMBuilderRef B, LLVMValueRef PointerVal, } -extern "C" -void -lp_set_load_alignment(LLVMValueRef Inst, - unsigned Align) -{ - llvm::unwrap<llvm::LoadInst>(Inst)->setAlignment(Align); -} +#if HAVE_LLVM < 0x0304 extern "C" void -lp_set_store_alignment(LLVMValueRef Inst, - unsigned Align) +LLVMSetAlignmentBackport(LLVMValueRef V, + unsigned Bytes) { - llvm::unwrap<llvm::StoreInst>(Inst)->setAlignment(Align); + switch (LLVMGetInstructionOpcode(V)) { + case LLVMLoad: + llvm::unwrap<llvm::LoadInst>(V)->setAlignment(Bytes); + break; + case LLVMStore: + llvm::unwrap<llvm::StoreInst>(V)->setAlignment(Bytes); + break; + default: + assert(0); + break; + } } +#endif + #if HAVE_LLVM < 0x0306 typedef llvm::JITMemoryManager BaseMemoryManager; |