From: Marek Olšák <marek.ol...@amd.com> --- src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 14 ++++++++++++++ src/gallium/auxiliary/gallivm/lp_bld_misc.h | 3 +++ 2 files changed, 17 insertions(+)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index bd4d4d3..da3cbdd 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -726,10 +726,24 @@ lp_get_called_value(LLVMValueRef call) extern "C" bool lp_is_function(LLVMValueRef v) { #if HAVE_LLVM >= 0x0309 return LLVMGetValueKind(v) == LLVMFunctionValueKind; #else return llvm::isa<llvm::Function>(llvm::unwrap(v)); #endif } + +extern "C" LLVMBuilderRef +lp_create_builder(LLVMContextRef ctx, bool unsafe_fpmath) +{ + LLVMBuilderRef builder = LLVMCreateBuilderInContext(ctx); + + if (unsafe_fpmath) { + llvm::FastMathFlags flags; + flags.setUnsafeAlgebra(); + llvm::unwrap(builder)->setFastMathFlags(flags); + } + + return builder; +} diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/src/gallium/auxiliary/gallivm/lp_bld_misc.h index a55c6bd..c499a6f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h @@ -75,16 +75,19 @@ lp_free_memory_manager(LLVMMCJITMemoryManagerRef memorymgr); extern void lp_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes); extern LLVMValueRef lp_get_called_value(LLVMValueRef call); extern bool lp_is_function(LLVMValueRef v); +extern LLVMBuilderRef +lp_create_builder(LLVMContextRef ctx, bool unsafe_fpmath); + #ifdef __cplusplus } #endif #endif /* !LP_BLD_MISC_H */ -- 2.7.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev