================
@@ -971,6 +952,72 @@ static void addFloatingPointOptions(const Driver &D, const
ArgList &Args,
CmdArgs.push_back("-freciprocal-math");
}
+// Add options related to IEEE Floating point modes
+//
+// Initial halting mode:
+// Validate -ffpe-trap= and forward it to -fc1. This is handled separately from
+// addFloatingPointOptions() on purpose: -ffpe-trap= is not part of the
+// fast-math option set, so it must not be skipped by that function's
+// -ffast-math fast path. The value check and the target-support warnings
depend
+// only on the option value and the target triple (no frontend-only state), so
+// they are done here in the driver rather than deferred to -fc1; -fc1 only
+// translates the list into its LangOptions bitmask.
+//
+// TODO:
+// Rounding modes
+// Underflow mode
+static void addIEEEFPModesOptions(const Driver &D, const ArgList &Args,
+ ArgStringList &CmdArgs,
+ const llvm::Triple &Triple) {
+ const Arg *A = Args.getLastArg(options::OPT_ffpe_trap_EQ);
+ if (!A)
+ return;
+
+ // The value is a comma-separated list of exception mnemonics. "none" and an
+ // empty list request no halting and reset any earlier request in the list;
+ // any other unrecognized mnemonic is an error.
+ llvm::SmallVector<StringRef, 6> Traps;
+ StringRef(A->getValue())
+ .split(Traps, ',', /*MaxSplit=*/-1, /*KeepEmpty=*/false);
+
+ bool RequestsTrap = false;
+ bool RequestsDenormal = false;
+ for (StringRef Trap : Traps) {
+ if (Trap == "none") {
+ RequestsTrap = false;
+ RequestsDenormal = false;
+ continue;
----------------
vntkmr wrote:
`none` can be present in the list of options, it nullifies the options
preceding it but has no effect on options following it. This is the same
behavior as GFortran ([Relevant function in GCC
codebase](https://github.com/gcc-mirror/gcc/blob/7c38c56214bf2809399a2198441bb48ee1b00512/gcc/fortran/options.cc#L579)).
However I think the documentation does look a bit misleading so I will update
that.
https://github.com/llvm/llvm-project/pull/208828
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits