diff options
author | Melanie Blower <melanie.blower@intel.com> | 2020-09-29 10:44:36 -0700 |
---|---|---|
committer | Melanie Blower <melanie.blower@intel.com> | 2020-10-25 06:46:25 -0700 |
commit | 2e204e23911b1f8bd1463535da40c6e48747a138 (patch) | |
tree | 258e489841ba64dbd08205485f0ef481f06dd545 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 3052e474eceb25e3699940d6a7270550eed66606 (diff) | |
download | llvm-2e204e23911b1f8bd1463535da40c6e48747a138.zip llvm-2e204e23911b1f8bd1463535da40c6e48747a138.tar.gz llvm-2e204e23911b1f8bd1463535da40c6e48747a138.tar.bz2 |
[clang] Enable support for #pragma STDC FENV_ACCESS
Reviewers: rjmccall, rsmith, sepavloff
Differential Revision: https://reviews.llvm.org/D87528
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 809e877..a1511e0 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1742,6 +1742,15 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, } } +void CodeGenModule::setLLVMFunctionFEnvAttributes(const FunctionDecl *D, + llvm::Function *F) { + if (D->hasAttr<StrictFPAttr>()) { + llvm::AttrBuilder FuncAttrs; + FuncAttrs.addAttribute("strictfp"); + F->addAttributes(llvm::AttributeList::FunctionIndex, FuncAttrs); + } +} + void CodeGenModule::SetCommonAttributes(GlobalDecl GD, llvm::GlobalValue *GV) { const Decl *D = GD.getDecl(); if (dyn_cast_or_null<NamedDecl>(D)) @@ -4587,9 +4596,11 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD, MaybeHandleStaticInExternC(D, Fn); - maybeSetTrivialComdat(*D, *Fn); + // Set CodeGen attributes that represent floating point environment. + setLLVMFunctionFEnvAttributes(D, Fn); + CodeGenFunction(*this).GenerateCode(GD, Fn, FI); setNonAliasAttributes(GD, Fn); |