[flang] Add -ffp-contract option processing
authorTom Eccles <Tom.Eccles@arm.com>
Mon, 31 Oct 2022 11:30:32 +0000 (11:30 +0000)
committerKiran Chandramohan <kiran.chandramohan@arm.com>
Mon, 31 Oct 2022 11:32:31 +0000 (11:32 +0000)
commita784de783af5096e593c5e214c2c78215fe303f5
tree2a28ce1db23ec96938387b793fb90b0fa1efc785
parent0fe945300524ab0d92842f236cfee867204aed14
[flang] Add -ffp-contract option processing

Only add the option processing and store the result. No attributes are
added to FIR yet.

Only the "off" and "fast" options are supported. "fast-honor-pragmas" is not applicable because we do not implement `#pragma clang fp contract()` in Fortran [1]. "on" is not supported because it is unclear how to fuse only within individual statements. gfortran also does not implement "on": treating it as an "off".

Currently the default value is "off" to preserve existing behavior. gfortran uses "fast" by default and that may be the right thing for flang-new after further discussion in the future, but that can be changed separately. gfortran's documentation is available [[ https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html | here ]].

[1] https://clang.llvm.org/docs/LanguageExtensions.html#extensions-to-specify-floating-point-flags

Reviewed By: vzakhari, awarzynski

Differential Revision: https://reviews.llvm.org/D136080
14 files changed:
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Flang.cpp
flang/include/flang/Frontend/CompilerInvocation.h
flang/include/flang/Frontend/LangOptions.def [new file with mode: 0644]
flang/include/flang/Frontend/LangOptions.h [new file with mode: 0644]
flang/lib/Frontend/CMakeLists.txt
flang/lib/Frontend/CompilerInvocation.cpp
flang/lib/Frontend/LangOptions.cpp [new file with mode: 0644]
flang/test/Driver/driver-help-hidden.f90
flang/test/Driver/driver-help.f90
flang/test/Driver/flang_f_opts.f90
flang/test/Driver/flang_fp_opts.f90 [new file with mode: 0644]
flang/test/Driver/frontend-forwarding.f90