[PATCH] D96864: [flang][driver] Add -Xflang and make -test-io a frontend-only flag

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 17 09:21:51 PST 2021


awarzynski added inline comments.


================
Comment at: flang/test/Frontend/input-output-file.f90:6
 !--------------------------
+! NOTE: We need `-E` below in order to instruct the compiler driver to create a job representing a fronted compiler invocation
 ! TEST 1: Print to stdout (implicit)
----------------
SouraVX wrote:
> I didn't follow this completely, Could you please elaborate a bit.
Sorry, I'm doing a poor job documenting this here.

Basically, we want to instruct `flang-new` to stop after the preprocessing phase. `-E` is a phase control flag. `-c` is another phase control flag. You can also skip phase flags all together:
```
$ bin/flang-new -ccc-print-phases file.f90
            +- 0: input, "file.f90", f95-cpp-input
         +- 1: preprocessor, {0}, f95
      +- 2: compiler, {1}, ir
   +- 3: backend, {2}, assembler
+- 4: assembler, {3}, object
5: linker, {4}, image
```
As you can see, without `-E` the driver, `flang-new`, would attempt to run multiple phases which would result in multiple compiler _jobs_. But we only want the compiler job, i.e. we are only interested the the first phase. (IIRC, compiler jobs map 1-1 to compiler phases).

So, `-E` is added here to make sure that `flang-new` doesn't try to do too much here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96864



More information about the cfe-commits mailing list