[flang][driver] Extend the `flang` bash script to act as a driver

Authored by awarzynski on Jul 1 2021, 1:33 AM.


[flang][driver] Extend the flang bash script to act as a driver

Until now, f18 would:

  1. Use Flang to unparse the input files
  2. Call an external Fortran compiler to compile the unparsed source files (generated in step 1)

With this patch, f18 will stop after unparsing the input source files,
i.e. step 1 above. The flang bash script will take care of step 2,
i.e. calling an external Fortran compiler driver to compile them. This

  • the functionality of f18 is reduced - it will only drive Flang (as opposed to delegating code-generation to an external tool on top of this)
  • we will able to switch between f18 and flang-new for unparsing before an external Fortran compiler is called for code-generation

The updated flang bash script needs to specify the output file when
using the -fdebug-unparse action. Both f18 and flang-new have been
updated accordingly.

These changes were discussed in [1] as a requirement for replacing f18
with flang-new.

[1] https://lists.llvm.org/pipermail/flang-dev/2021-April/000677.html

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