aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorMelanie Blower <melanie.blower@intel.com>2020-04-27 07:25:59 -0700
committerMelanie Blower <melanie.blower@intel.com>2020-05-01 06:14:24 -0700
commit4f1e9a17e9d28bdfd035313c96b3a5d4c91a7733 (patch)
tree190cc721b8fddd973671478d84d769c831acc187 /clang/lib/Frontend/CompilerInvocation.cpp
parente3c0be596c2b672d25faabd1b637549fbd29a714 (diff)
downloadllvm-4f1e9a17e9d28bdfd035313c96b3a5d4c91a7733.zip
llvm-4f1e9a17e9d28bdfd035313c96b3a5d4c91a7733.tar.gz
llvm-4f1e9a17e9d28bdfd035313c96b3a5d4c91a7733.tar.bz2
Add support for #pragma float_control
Reviewers: rjmccall, erichkeane, sepavloff Differential Revision: https://reviews.llvm.org/D72841
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index b327fa9..391f0e9 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2455,7 +2455,7 @@ static const StringRef GetInputKindName(InputKind IK) {
static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
const TargetOptions &TargetOpts,
- PreprocessorOptions &PPOpts,
+ PreprocessorOptions &PPOpts, CodeGenOptions &CGOpts,
DiagnosticsEngine &Diags) {
// FIXME: Cleanup per-file based stuff.
LangStandard::Kind LangStd = LangStandard::lang_unspecified;
@@ -3187,6 +3187,19 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
Opts.UnsafeFPMath = Args.hasArg(OPT_menable_unsafe_fp_math) ||
Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
Args.hasArg(OPT_cl_fast_relaxed_math);
+ Opts.AllowFPReassoc = Opts.FastMath || CGOpts.Reassociate;
+ Opts.NoHonorNaNs =
+ Opts.FastMath || CGOpts.NoNaNsFPMath || Opts.FiniteMathOnly;
+ Opts.NoHonorInfs =
+ Opts.FastMath || CGOpts.NoInfsFPMath || Opts.FiniteMathOnly;
+ Opts.NoSignedZero = Opts.FastMath || CGOpts.NoSignedZeros;
+ Opts.AllowRecip = Opts.FastMath || CGOpts.ReciprocalMath;
+ // Currently there's no clang option to enable this individually
+ Opts.ApproxFunc = Opts.FastMath;
+ Opts.denormalIsIEEE =
+ !(CGOpts.FPDenormalMode.isValid() && CGOpts.FP32DenormalMode.isValid()) ||
+ (CGOpts.FPDenormalMode == llvm::DenormalMode::getIEEE() &&
+ CGOpts.FP32DenormalMode == llvm::DenormalMode::getIEEE());
if (Arg *A = Args.getLastArg(OPT_ffp_contract)) {
StringRef Val = A->getValue();
@@ -3640,7 +3653,7 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
// Other LangOpts are only initialized when the input is not AST or LLVM IR.
// FIXME: Should we really be calling this for an Language::Asm input?
ParseLangArgs(LangOpts, Args, DashX, Res.getTargetOpts(),
- Res.getPreprocessorOpts(), Diags);
+ Res.getPreprocessorOpts(), Res.getCodeGenOpts(), Diags);
if (Res.getFrontendOpts().ProgramAction == frontend::RewriteObjC)
LangOpts.ObjCExceptions = 1;
if (T.isOSDarwin() && DashX.isPreprocessed()) {