[all-commits] [llvm/llvm-project] a65afc: [flang][driver] Add support for -save-temps

Andrzej WarzyƄski via All-commits all-commits at lists.llvm.org
Fri May 6 01:41:49 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a65afce731c2fa91effcfa5d4917d6ad90a28bf0
      https://github.com/llvm/llvm-project/commit/a65afce731c2fa91effcfa5d4917d6ad90a28bf0
  Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
  Date:   2022-05-06 (Fri, 06 May 2022)

  Changed paths:
    M clang/include/clang/Driver/Options.td
    M clang/include/clang/Driver/Types.def
    M flang/test/Driver/driver-help-hidden.f90
    M flang/test/Driver/driver-help.f90
    A flang/test/Driver/fno-integrated-as.f90
    A flang/test/Driver/save-temps.f90

  Log Message:
  -----------
  [flang][driver] Add support for -save-temps

This patch adds support for `-save-temps` in `flang-new`, Flang's
compiler driver. The semantics of this option are inherited from Clang.

The file extension for temporary Fortran preprocessed files is set to
`i`. This is identical to what Clang uses for C (or C++) preprocessed
files. I have tried researching what other compilers do here, but I
couldn't find any definitive answers. One GFortran thread [1] suggests
that indeed it is not clear what the right approach should be.

Normally, various phases in Clang/Flang are combined. The `-save-temps`
option works by forcing the compiler to run every phase separately. As
there is no integrated assembler driver in Flang, user will have to use
`-save-temps` together with `-fno-integrated-as`. Otherwise, an
invocation to the integrated assembler would be generated generated,
which is going to fail (i.e. something equivalent to `clang -cc1as` from
Clang).

There are no specific plans for implementing an integrated assembler for
Flang for now. One possible solution would be to share it entirely with
Clang.

Note that on Windows you will get the following error when using
`-fno-integrated-as`:
```bash
  flang-new: error: there is no external assembler that can be used on this platform
```
Unfortunately, I don't have access to a Windows machine to investigate
this. Instead, I marked the tests in this patch as unsupported on
Windows.

[1] https://gcc.gnu.org/bugzilla//show_bug.cgi?id=81615

Differential Revision: https://reviews.llvm.org/D124669




More information about the All-commits mailing list