[all-commits] [llvm/llvm-project] 257b29: [flang][driver] Add the new flang compiler and fro...

CarolineConcatto via All-commits all-commits at lists.llvm.org
Fri Sep 11 03:00:52 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 257b29715bb27b7d9f6c3c40c481b6a4af0b37e5
      https://github.com/llvm/llvm-project/commit/257b29715bb27b7d9f6c3c40c481b6a4af0b37e5
  Author: Caroline Concatto <caroline.concatto at arm.com>
  Date:   2020-09-11 (Fri, 11 Sep 2020)

  Changed paths:
    M clang/include/clang/Driver/Driver.h
    M clang/include/clang/Driver/Options.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Driver/ToolChains/Flang.cpp
    M clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
    M clang/lib/Tooling/Tooling.cpp
    M clang/test/Driver/flang/flang.f90
    M clang/test/Driver/flang/flang_ucase.F90
    M clang/test/Driver/flang/multiple-inputs-mixed.f90
    M clang/test/Driver/flang/multiple-inputs.f90
    M clang/unittests/Driver/SanitizerArgsTest.cpp
    M clang/unittests/Driver/ToolChainTest.cpp
    M flang/CMakeLists.txt
    M flang/README.md
    A flang/include/flang/Frontend/CompilerInstance.h
    A flang/include/flang/Frontend/CompilerInvocation.h
    A flang/include/flang/Frontend/FrontendOptions.h
    A flang/include/flang/FrontendTool/Utils.h
    M flang/lib/CMakeLists.txt
    A flang/lib/Frontend/CMakeLists.txt
    A flang/lib/Frontend/CompilerInstance.cpp
    A flang/lib/Frontend/CompilerInvocation.cpp
    A flang/lib/Frontend/FrontendOptions.cpp
    A flang/lib/FrontendTool/CMakeLists.txt
    A flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
    M flang/test/CMakeLists.txt
    A flang/test/Flang-Driver/driver-error-cc1.c
    A flang/test/Flang-Driver/driver-error-cc1.cpp
    A flang/test/Flang-Driver/driver-help.f90
    A flang/test/Flang-Driver/driver-version.f90
    A flang/test/Flang-Driver/emit-obj.f90
    A flang/test/Flang-Driver/missing-input.f90
    M flang/test/lit.cfg.py
    M flang/test/lit.site.cfg.py.in
    M flang/tools/CMakeLists.txt
    A flang/tools/flang-driver/CMakeLists.txt
    A flang/tools/flang-driver/driver.cpp
    A flang/tools/flang-driver/fc1_main.cpp
    M flang/unittests/CMakeLists.txt
    A flang/unittests/Frontend/CMakeLists.txt
    A flang/unittests/Frontend/CompilerInstanceTest.cpp
    M llvm/include/llvm/Option/OptTable.h

  Log Message:
  -----------
  [flang][driver] Add the new flang compiler and frontend drivers

Summary:

This is the first patch implementing the new Flang driver as outlined in [1],
[2] & [3]. It creates Flang driver (`flang-new`) and Flang frontend driver
(`flang-new -fc1`). These will be renamed as `flang` and `flang -fc1` once the
current Flang throwaway driver, `flang`, can be replaced with `flang-new`.

Currently only 2 options are supported: `-help` and `--version`.

`flang-new` is implemented in terms of libclangDriver, defaulting the driver
mode to `FlangMode` (added to libclangDriver in [4]). This ensures that the
driver runs in Flang mode regardless of the name of the binary inferred from
argv[0].

The design of the new Flang compiler and frontend drivers is inspired by it
counterparts in Clang [3]. Currently, the new Flang compiler and frontend
drivers re-use Clang libraries: clangBasic, clangDriver and clangFrontend.

To identify Flang options, this patch adds FlangOption/FC1Option enums.
Driver::printHelp is updated so that `flang-new` prints only Flang options.
The new Flang driver is disabled by default. To enable it, set
`-DBUILD_FLANG_NEW_DRIVER=ON` when configuring CMake and add clang to
`LLVM_ENABLE_PROJECTS` (e.g. -DLLVM_ENABLE_PROJECTS=“clang;flang;mlir”).

[1] “RFC: new Flang driver - next steps”
http://lists.llvm.org/pipermail/flang-dev/2020-July/000470.html
[2] “RFC: Adding a fortran mode to the clang driver for flang”
http://lists.llvm.org/pipermail/cfe-dev/2019-June/062669.html
[3] “RFC: refactoring libclangDriver/libclangFrontend to share with Flang”
http://lists.llvm.org/pipermail/cfe-dev/2020-July/066393.html
[4] https://reviews.llvm.org/rG6bf55804924d5a1d902925ad080b1a2b57c5c75c

co-authored-by: Andrzej Warzynski <andrzej.warzynski at arm.com>

Reviewed By: richard.barton.arm, sameeranjoshi

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




More information about the All-commits mailing list