This is an archive of the discontinued LLVM Phabricator instance.

[flang][driver] Add -Xflang and make -test-io a frontend-only flag
ClosedPublic

Authored by awarzynski on Feb 17 2021, 6:22 AM.

Details

Summary

This patch adds support for -Xflang in flang-new. The semantics are
identical to -Xclang.

With the addition of -Xflang, we can modify -test-io to be a
compiler-frontend only flag. This makes more sense, this flag is:

  • very frontend specific
  • to be used for development and testing only
  • not to be exposed to the end user

Originally we added it to the compiler driver, flang-new, in order to
facilitate testing. With -Xflang this is no longer needed. Tests are
updated accordingly.

Diff Detail

Event Timeline

awarzynski created this revision.Feb 17 2021, 6:22 AM
awarzynski requested review of this revision.Feb 17 2021, 6:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2021, 6:22 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
awarzynski retitled this revision from [flang][driver] Add -Xflang and make -test-io a frontend-only flang to [flang][driver] Add -Xflang and make -test-io a frontend-only flag.Feb 17 2021, 6:25 AM
awarzynski added a project: Restricted Project.

Thanks! for the patch @awarzynski . I support this enhancement. LGTM(Not accepting formally :) ), Let's wait and hear from others also, what's their take on this.

SouraVX added inline comments.Feb 17 2021, 7:56 AM
flang/test/Frontend/input-output-file.f90
6

I didn't follow this completely, Could you please elaborate a bit.

awarzynski added inline comments.Feb 17 2021, 9:21 AM
flang/test/Frontend/input-output-file.f90
6

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.

SouraVX added inline comments.Feb 17 2021, 10:25 AM
flang/test/Frontend/input-output-file.f90
6

Great - thanks for explaining the intent!

SouraVX accepted this revision.Feb 21 2021, 9:09 PM
This revision is now accepted and ready to land.Feb 21 2021, 9:09 PM

Thanks for reviewing @SouraVX ! I did update that comment before merging. Hopefully it _will_ make sense when we come back to it at later time :)