[PATCH] D93769: [clang] Add support for option -ffp-eval-method and extend #pragma float_control similarly
Melanie Blower via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 4 10:23:32 PDT 2021
mibintc marked 5 inline comments as done.
mibintc added inline comments.
================
Comment at: clang/include/clang/Basic/LangOptions.h:234
+ FEM_Extended,
+ /// Use the default float eval method specified by Target
+ FEM_TargetDefault
----------------
mibintc wrote:
> aaron.ballman wrote:
> > FYI: it may be somewhat confusing that we have an enumerator with `default` in the name but that enumerator isn't the default.
> That's true. I had a heck of a time getting the initialization of the lang option setting correct: the setting should come from the TargetInfo if command line options don't override. That seems simple enough but there's somethng really odd about initialization. Adding the "default target" enumeral allowed me to get it initialized the way I wanted.
I redid the comments to eliminate the confusion
================
Comment at: clang/lib/Sema/SemaAttr.cpp:429
+ case PFC_Source:
+ //Builder.defineMacro("__FLT_EVAL_METHOD__", Twine("0"));
+ NewFPFeatures.setFPEvalMethodOverride(LangOptions::FEM_Source);
----------------
mibintc wrote:
> @rjmccall I would like to push a new value for __FLT_EVAL_METHOD__ at the start of the scope of this pragma, then pop that value of the macro to restore the previous setting when the scope is exited, should I do that in ParsePragma? Can I do that by injecting "pragma push_macro(...)" into the token stream, do you have other suggestion or is there something similar in clang that I can study how to do this?
Nevermind, I found a way to set the macro.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93769/new/
https://reviews.llvm.org/D93769
More information about the cfe-commits
mailing list