diff options
author | Marek Olšák <[email protected]> | 2016-07-12 18:49:57 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-07-13 19:46:16 +0200 |
commit | 6596ecf8c50b6400b02a018a438a8de98de48761 (patch) | |
tree | ce6b970c6e5df88aa1dfe8b1a60918235e948cb7 /src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | |
parent | bccf9de4df93a53cad7a3a6ffdcea1ebc956487d (diff) |
gallivm: add helper lp_add_attr_dereferenceable
Not sure if this is the right way to do it, but it seems to work.
v2: make it a no-op on LLVM <= 3.5
Reviewed-by: Roland Scheidegger <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_misc.cpp')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 23ef3edeae7..791a4702556 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -697,3 +697,14 @@ lp_free_memory_manager(LLVMMCJITMemoryManagerRef memorymgr) { delete reinterpret_cast<BaseMemoryManager*>(memorymgr); } + +extern "C" void +lp_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes) +{ +#if HAVE_LLVM >= 0x0306 + llvm::Argument *A = llvm::unwrap<llvm::Argument>(val); + llvm::AttrBuilder B; + B.addDereferenceableAttr(bytes); + A->addAttr(llvm::AttributeSet::get(A->getContext(), A->getArgNo() + 1, B)); +#endif +} |