diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h --- a/llvm/include/llvm-c/Core.h +++ b/llvm/include/llvm-c/Core.h @@ -3535,7 +3535,24 @@ * @see llvm::IRBuilder::SetInstDebugLocation() */ void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst); - + +/** + * Get the dafult floating-point math metadata for a given builder. + * + * @see llvm::IRBuilder::getDefaultFPMathTag() + */ +LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder); + +/** + * Set the default floating-point math metadata for the given builder. + * + * To clear the metadata, pass NULL to \p FPMathTag. + * + * @see llvm::IRBuilder::setDefaultFPMathTag() + */ +void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder, + LLVMMetadataRef FPMathTag); + /** * Deprecated: Passing the NULL location will crash. * Use LLVMGetCurrentDebugLocation2 instead. diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -3033,6 +3033,18 @@ unwrap(Builder)->SetInstDebugLocation(unwrap(Inst)); } +void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder, + LLVMMetadataRef FPMathTag) { + + unwrap(Builder)->setDefaultFPMathTag(FPMathTag + ? unwrap(FPMathTag) + : nullptr); +} + +LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder) { + return wrap(unwrap(Builder)->getDefaultFPMathTag()); +} + /*--.. Instruction builders ................................................--*/ LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B) {