[PATCH] D136080: [flang] Add -ffp-contract option processing

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 20 09:07:25 PDT 2022


awarzynski added inline comments.


================
Comment at: flang/test/Driver/driver-help-hidden.f90:34
 ! CHECK-NEXT: Use <value> as character line width in fixed mode
+! CHECK-NEXT: -ffp-contract=<value> Form fused FP ops (e.g. FMAs): fast (fuses across statements disregarding pragmas) | on (only fuses in the same statement unless dictated by pragmas) | off (never fuses) | fast-honor-pragmas (fuses across statements unless diectated by pragmas). Default is 'fast' for CUDA, 'fast-honor-pragmas' for HIP, and 'on' otherwise.
 ! CHECK-NEXT: -ffree-form            Process source files in free form
----------------
tblah wrote:
> vzakhari wrote:
> > Is it easy to emit a different help message for Flang to say that there are only two modes for Fortran?
> @awarzynski tells me there is no way to do this short of having separate `Options.td` for flang and clang. Once we have settled on which arguments to support, I will update the shared help text to mention flang.
Both `clang -help` and `flang-new -help` must be 100% correct. As this help text is not valid in the case of LLVM Flang, it needs to be updated accordingly. 

As @tblah points out, there's no straightforward mechanism for having a custom help texts for `clang` and `flang-new` in Clang's driver library ATM. But I think that this can be achieved even without creating a separate "Options.td" file. One would have to define a new tablegen record in "Options.td". That would be a separate patch though, probably accompanied by an RFC.

There's a different solution too. Note that currently the definition uses the `HelpText` field. However, you could use [[ https://github.com/llvm/llvm-project/blob/b1d7a95e4e4a2b57cbe02636bbe357dc48d615c5/clang/include/clang/Driver/Options.td#L81-L82 | DocBrief ]] instead (which we used to solve a similar issue with [[ https://github.com/llvm/llvm-project/blob/b1d7a95e4e4a2b57cbe02636bbe357dc48d615c5/clang/include/clang/Driver/Options.td#L696-L704 | -I ]]). That's what I suggest that you do. Basically, copy the contents of `HelpText` for `-ffp-contract` into a `DocBrief` field (we don't use this field in Flang and it should probably be renamed as `DocBriefClang`). `HelpText` should be replaced with something brief that applies both to Clang and Flang.

Btw, what's the help-text/spelling in `gfortran`?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136080/new/

https://reviews.llvm.org/D136080



More information about the cfe-commits mailing list