diff options
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 14 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_misc.h | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index bd4d4d3c094..da3cbdd53c5 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -733,3 +733,17 @@ lp_is_function(LLVMValueRef v) 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 a55c6bd508d..c499a6f51eb 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h @@ -82,6 +82,9 @@ 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 |