diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -4996,14 +4996,6 @@ def fno_sycl : Flag<["-"], "fno-sycl">, Flags<[NoXarchOption, CoreOption]>, Group, HelpText<"Disables SYCL kernels compilation for device">; -//===----------------------------------------------------------------------===// -// FLangOption + NoXarchOption -//===----------------------------------------------------------------------===// - -def flang_experimental_exec : Flag<["-"], "flang-experimental-exec">, - Flags<[FlangOption, FlangOnlyOption, NoXarchOption, HelpHidden]>, - HelpText<"Enable support for generating executables (experimental)">; - //===----------------------------------------------------------------------===// // FLangOption + CoreOption + NoXarchOption //===----------------------------------------------------------------------===// diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -1927,7 +1927,7 @@ void Driver::PrintVersion(const Compilation &C, raw_ostream &OS) const { if (IsFlangMode()) { - OS << getClangToolFullVersion("flang-new") << '\n'; + OS << getClangToolFullVersion("flang") << '\n'; } else { // FIXME: The following handlers should use a callback mechanism, we don't // know what the client would like to do. diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -901,12 +901,6 @@ void tools::addFortranRuntimeLibraryPath(const ToolChain &TC, const llvm::opt::ArgList &Args, ArgStringList &CmdArgs) { - // NOTE: Generating executables by Flang is considered an "experimental" - // feature and hence this is guarded with a command line option. - // TODO: Make this work unconditionally once Flang is mature enough. - if (!Args.hasArg(options::OPT_flang_experimental_exec)) - return; - // Default to the /../lib directory. This works fine on the // platforms that we have tested so far. We will probably have to re-fine // this in the future. In particular, on some platforms, we may need to use diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp --- a/clang/lib/Driver/ToolChains/Flang.cpp +++ b/clang/lib/Driver/ToolChains/Flang.cpp @@ -346,14 +346,16 @@ CmdArgs.push_back(Input.getFilename()); - // TODO: Replace flang-new with flang once the new driver replaces the - // throwaway driver - const char *Exec = Args.MakeArgString(D.GetProgramPath("flang-new", TC)); + // Get the name of this executable. The `getClangProgramPath` hook predates + // Flang, hence the name assumes that it's a Clang program. In practice, it + // can be any program (e.g. a Flang program) implemented in terms of + // `clangDriver`. + const char *Exec = D.getClangProgramPath(); C.addCommand(std::make_unique(JA, *this, ResponseFileSupport::AtFileUTF8(), Exec, CmdArgs, Inputs, Output)); } -Flang::Flang(const ToolChain &TC) : Tool("flang-new", "flang frontend", TC) {} +Flang::Flang(const ToolChain &TC) : Tool("flang", "flang frontend", TC) {} Flang::~Flang() {} diff --git a/clang/test/Driver/flang/flang.f90 b/clang/test/Driver/flang/flang.f90 --- a/clang/test/Driver/flang/flang.f90 +++ b/clang/test/Driver/flang/flang.f90 @@ -13,7 +13,7 @@ ! * (no type specified, resulting in an object file) ! All invocations should begin with flang -fc1, consume up to here. -! ALL-LABEL: "{{[^"]*}}flang-new" "-fc1" +! ALL-LABEL: "{{[^"]*}}flang" "-fc1" ! Check that f90 files are not treated as "previously preprocessed" ! ... in --driver-mode=flang. diff --git a/clang/test/Driver/flang/flang_ucase.F90 b/clang/test/Driver/flang/flang_ucase.F90 --- a/clang/test/Driver/flang/flang_ucase.F90 +++ b/clang/test/Driver/flang/flang_ucase.F90 @@ -13,7 +13,7 @@ ! * (no type specified, resulting in an object file) ! All invocations should begin with flang -fc1, consume up to here. -! ALL-LABEL: "{{[^"]*}}flang-new" "-fc1" +! ALL-LABEL: "{{[^"]*}}flang" "-fc1" ! Check that f90 files are not treated as "previously preprocessed" ! ... in --driver-mode=flang. diff --git a/clang/test/Driver/flang/multiple-inputs-mixed.f90 b/clang/test/Driver/flang/multiple-inputs-mixed.f90 --- a/clang/test/Driver/flang/multiple-inputs-mixed.f90 +++ b/clang/test/Driver/flang/multiple-inputs-mixed.f90 @@ -1,7 +1,7 @@ ! Check that flang can handle mixed C and fortran inputs. ! RUN: %clang --driver-mode=flang -### -fsyntax-only %S/Inputs/one.f90 %S/Inputs/other.c 2>&1 | FileCheck --check-prefixes=CHECK-SYNTAX-ONLY %s -! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang-new{{[^"/]*}}" "-fc1" +! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang{{[^"/]*}}" "-fc1" ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/one.f90" ! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}clang{{[^"/]*}}" "-cc1" ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/other.c" diff --git a/clang/test/Driver/flang/multiple-inputs.f90 b/clang/test/Driver/flang/multiple-inputs.f90 --- a/clang/test/Driver/flang/multiple-inputs.f90 +++ b/clang/test/Driver/flang/multiple-inputs.f90 @@ -1,7 +1,7 @@ ! Check that flang driver can handle multiple inputs at once. ! RUN: %clang --driver-mode=flang -### -fsyntax-only %S/Inputs/one.f90 %S/Inputs/two.f90 2>&1 | FileCheck --check-prefixes=CHECK-SYNTAX-ONLY %s -! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang-new" "-fc1" +! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang" "-fc1" ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/one.f90" -! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang-new" "-fc1" +! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang" "-fc1" ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/two.f90" diff --git a/flang/docs/FlangDriver.md b/flang/docs/FlangDriver.md --- a/flang/docs/FlangDriver.md +++ b/flang/docs/FlangDriver.md @@ -14,17 +14,13 @@ ``` There are two main drivers in Flang: -* the compiler driver, `flang-new` -* the frontend driver, `flang-new -fc1` - -> **_NOTE:_** The diagrams in this document refer to `flang` as opposed to -> `flang-new`. Eventually, `flang-new` will be renamed as `flang` and the -> diagrams reflect the final design that we are still working towards. +* the compiler driver, `flang` +* the frontend driver, `flang -fc1` The **compiler driver** will allow you to control all compilation phases (e.g. preprocessing, semantic checks, code-generation, code-optimisation, lowering and linking). For frontend specific tasks, the compiler driver creates a -Fortran compilation job and delegates it to `flang-new -fc1`, the frontend +Fortran compilation job and delegates it to `flang -fc1`, the frontend driver. For linking, it creates a linker job and calls an external linker (e.g. LLVM's [`lld`](https://lld.llvm.org/)). It can also call other tools such as external assemblers (e.g. [`as`](https://www.gnu.org/software/binutils/)). In @@ -46,7 +42,7 @@ driver for Flang, LLVM and MLIR libraries. Contrary to the compiler driver, it is not capable of calling any external tools (including linkers). It is aware of all the frontend internals that are "hidden" from the compiler driver. It -accepts many frontend-specific options not available in `flang-new` and as such +accepts many frontend-specific options not available in `flang` and as such it provides a finer control over the frontend. Note that this tool is mostly intended for Flang developers. In particular, there are no guarantees about the stability of its interface and compiler developers can use it to experiment @@ -61,30 +57,30 @@ e.g.: ```lang=bash -flang-new -Xflang -fdebug-dump-parse-tree input.f95 +flang -Xflang -fdebug-dump-parse-tree input.f95 ``` -In the invocation above, `-fdebug-dump-parse-tree` is forwarded to `flang-new +In the invocation above, `-fdebug-dump-parse-tree` is forwarded to `flang -fc1`. Without the forwarding flag, `-Xflang`, you would see the following warning: ```lang=bash -flang-new: warning: argument unused during compilation: +flang: warning: argument unused during compilation: ``` -As `-fdebug-dump-parse-tree` is only supported by `flang-new -fc1`, `flang-new` +As `-fdebug-dump-parse-tree` is only supported by `flang -fc1`, `flang` will ignore it when used without `Xflang`. ## Why Do We Need Two Drivers? -As hinted above, `flang-new` and `flang-new -fc1` are two separate tools. The -fact that these tools are accessed through one binary, `flang-new`, is just an +As hinted above, `flang` and `flang -fc1` are two separate tools. The +fact that these tools are accessed through one binary, `flang`, is just an implementation detail. Each tool has a separate list of options, albeit defined in the same file: `clang/include/clang/Driver/Options.td`. The separation helps us split various tasks and allows us to implement more -specialised tools. In particular, `flang-new` is not aware of various +specialised tools. In particular, `flang` is not aware of various compilation phases within the frontend (e.g. scanning, parsing or semantic -checks). It does not have to be. Conversely, the frontend driver, `flang-new +checks). It does not have to be. Conversely, the frontend driver, `flang -fc1`, needs not to be concerned with linkers or other external tools like assemblers. Nor does it need to know where to look for various systems libraries, which is usually OS and platform specific. @@ -103,7 +99,7 @@ In fact, Flang needs to adhere to this model in order to be able to re-use Clang's driver library. If you are more familiar with the [architecture of GFortran](https://gcc.gnu.org/onlinedocs/gcc-4.7.4/gfortran/About-GNU-Fortran.html) -than Clang, then `flang-new` corresponds to `gfortran` and `flang-new -fc1` to +than Clang, then `flang` corresponds to `gfortran` and `flang -fc1` to `f951`. ## Compiler Driver @@ -134,7 +130,7 @@ `-ccc-print-phases` flag to see the sequence of actions that the driver will create for your compiler invocation: ```bash -flang-new -ccc-print-phases -E file.f +flang -ccc-print-phases -E file.f +- 0: input, "file.f", f95-cpp-input 1: preprocessor, {0}, f95 ``` @@ -142,18 +138,13 @@ after preprocessing. The first job simply prepares the input. For `-c`, the pipeline of the created jobs is more complex: ```bash -flang-new -ccc-print-phases -c file.f +flang -ccc-print-phases -c file.f +- 0: input, "file.f", f95-cpp-input +- 1: preprocessor, {0}, f95 +- 2: compiler, {1}, ir +- 3: backend, {2}, assembler 4: assembler, {3}, object ``` -Note that currently Flang does not support code-generation and `flang-new` will -fail during the second step above with the following error: -```bash -error: code-generation is not available yet -``` The other phases are printed nonetheless when using `-ccc-print-phases`, as that reflects what `clangDriver`, the library, will try to create and run. @@ -162,7 +153,7 @@ instance of `clang::driver::Command`). Every command is bound to an instance of `clang::driver::Tool`. For Flang we introduced a specialisation of this class: `clang::driver::Flang`. This class implements the logic to either translate or -forward compiler options to the frontend driver, `flang-new -fc1`. +forward compiler options to the frontend driver, `flang -fc1`. You can read more on the design of `clangDriver` in Clang's [Driver Design & Internals](https://clang.llvm.org/docs/DriverInternals.html). @@ -197,26 +188,26 @@ This list is not exhaustive and only covers the main classes that implement the driver. The main entry point for the frontend driver, `fc1_main`, is implemented in `flang/tools/flang-driver/driver.cpp`. It can be accessed by -invoking the compiler driver, `flang-new`, with the `-fc1` flag. +invoking the compiler driver, `flang`, with the `-fc1` flag. The frontend driver will only run one action at a time. If you specify multiple action flags, only the last one will be taken into account. The default action is `ParseSyntaxOnlyAction`, which corresponds to `-fsyntax-only`. In other -words, `flang-new -fc1 ` is equivalent to `flang-new -fc1 -fsyntax-only +words, `flang -fc1 ` is equivalent to `flang -fc1 -fsyntax-only `. ## The `flang-to-external-fc` script -The `flang-to-external-fc` wrapper script for `flang-new` was introduced as a +The `flang-to-external-fc` wrapper script for `flang` was introduced as a development tool and to facilitate testing. The `flang-to-external-fc` wrapper script will: -* use `flang-new` to unparse the input source file (i.e. it will run `flang-new +* use `flang` to unparse the input source file (i.e. it will run `flang -fc1 -fdebug-unparse `), and then * call a host Fortran compiler, e.g. `gfortran`, to compile the unparsed file. Here's a basic breakdown of what happens inside `flang-to-external-fc` when you run `flang-to-external-fc file.f90`: ```bash -flang-new -fc1 -fdebug-unparse file.f90 -o file-unparsed.f90 +flang -fc1 -fdebug-unparse file.f90 -o file-unparsed.f90 gfortran file-unparsed.f90 ``` This is a simplified version for illustration purposes only. In practice, @@ -247,8 +238,8 @@ For every new option, you will also have to define the visibility of the new option. This is controlled through the `Flags` field. You can use the following Flang specific option flags to control this: - * `FlangOption` - this option will be available in the `flang-new` compiler driver, - * `FC1Option` - this option will be available in the `flang-new -fc1` frontend driver, + * `FlangOption` - this option will be available in the `flang` compiler driver, + * `FC1Option` - this option will be available in the `flang -fc1` frontend driver, * `FlangOnlyOption` - this option will not be visible in Clang drivers. Please make sure that options that you add are only visible in drivers that can @@ -277,10 +268,10 @@ When adding a compiler driver option (i.e. an option that contains `FlangOption` among its `Flags`) that you also intend to be understood by the -frontend, make sure that it is either forwarded to `flang-new -fc1` or translated +frontend, make sure that it is either forwarded to `flang -fc1` or translated into some other option that is accepted by the frontend driver. In the case of options that contain both `FlangOption` and `FC1Option` among its flags, we -usually just forward from `flang-new` to `flang-new -fc1`. This is then tested in +usually just forward from `flang` to `flang -fc1`. This is then tested in `flang/test/Driver/frontend-forward.F90`. What follows is usually very dependant on the meaning of the corresponding @@ -326,31 +317,28 @@ # CMake Support As of [#7246](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7246) -(and soon to be released CMake 3.24.0), `cmake` can detect `flang-new` as a +(and soon to be released CMake 3.24.0), `cmake` can detect `flang` as a supported Fortran compiler. You can configure your CMake projects to use -`flang-new` as follows: +`flang` as follows: ```bash -cmake -DCMAKE_Fortran_FLAGS="-flang-experimental-exec" -DCMAKE_Fortran_COMPILER= +cmake -DCMAKE_Fortran_COMPILER= ``` You should see the following in the output: ``` -- The Fortran compiler identification is LLVMFlang ``` -where `` corresponds to the LLVM Flang version. Note that while -generating executables remains experimental, you will need to inform CMake to -use the `-flang-experimental-exec` flag when invoking `flang-new` as in the -example above. +where `` corresponds to the LLVM Flang version. # Testing In LIT, we define two variables that you can use to invoke Flang's drivers: -* `%flang` is expanded as `flang-new` (i.e. the compiler driver) -* `%flang_fc1` is expanded as `flang-new -fc1` (i.e. the frontend driver) +* `%flang` is expanded as `flang` (i.e. the compiler driver) +* `%flang_fc1` is expanded as `flang -fc1` (i.e. the frontend driver) For most regression tests for the frontend, you will want to use `%flang_fc1`. In some cases, the observable behaviour will be identical regardless of whether `%flang` or `%flang_fc1` is used. However, when you are using `%flang` instead of `%flang_fc1`, the compiler driver will add extra flags to the frontend -driver invocation (i.e. `flang-new -fc1 -`). In some cases that might +driver invocation (i.e. `flang -fc1 -`). In some cases that might be exactly what you want to test. In fact, you can check these additional flags by using the `-###` compiler driver command line option. @@ -370,7 +358,7 @@ * [Creating a plugin](#creating-a-plugin) * [Loading and running a plugin](#loading-and-running-a-plugin) -Flang plugins are limited to `flang-new -fc1` and are currently only available / +Flang plugins are limited to `flang -fc1` and are currently only available / been tested on Linux. ## Creating a Plugin @@ -455,14 +443,14 @@ ## Loading and Running a Plugin In order to use plugins, there are 2 command line options made available to the -frontend driver, `flang-new -fc1`: +frontend driver, `flang -fc1`: * [`-load `](#the--load-dsopath-option) for loading the dynamic shared object of the plugin * [`-plugin `](#the--plugin-name-option) for calling the registered plugin Invocation of the example plugin is done through: ```bash -flang-new -fc1 -load flangPrintFunctionNames.so -plugin print-fns file.f90 +flang -fc1 -load flangPrintFunctionNames.so -plugin print-fns file.f90 ``` Both these options are parsed in `flang/lib/Frontend/CompilerInvocation.cpp` and @@ -483,7 +471,7 @@ ## Enabling In-Tree Plugins For in-tree plugins, there is the CMake flag `FLANG_PLUGIN_SUPPORT`, enabled by -default, that controls the exporting of executable symbols from `flang-new`, +default, that controls the exporting of executable symbols from `flang`, which plugins need access to. Additionally, there is the CMake flag `FLANG_BUILD_EXAMPLES`, turned off by default, that is used to control if the example programs are built. This includes plugins that are in the @@ -519,7 +507,7 @@ [`llvm::PassBuilder`](https://llvm.org/doxygen/classllvm_1_1PassBuilder.html) for details. -The framework to enable pass plugins in `flang-new` uses the exact same +The framework to enable pass plugins in `flang` uses the exact same machinery as that used by `clang` and thus has the same capabilities and limitations. @@ -527,7 +515,7 @@ shared object which is then loaded using the `-fpass-plugin` option. ``` -flang-new -fpass-plugin=/path/to/plugin.so +flang -fpass-plugin=/path/to/plugin.so ``` This option is available in both the compiler driver and the frontend driver. @@ -539,7 +527,7 @@ statically. Setting `-DLLVM_${NAME}_LINK_INTO_TOOLS` to `ON` in the cmake command turns the project into a statically linked extension. An example would be Polly, e.g., using `-DLLVM_POLLY_LINK_INTO_TOOLS=ON` would link Polly passes -into `flang-new` as built-in middle-end passes. +into `flang` as built-in middle-end passes. See the [`WritingAnLLVMNewPMPass`](https://llvm.org/docs/WritingAnLLVMNewPMPass.html#id9) diff --git a/flang/docs/ImplementingASemanticCheck.md b/flang/docs/ImplementingASemanticCheck.md --- a/flang/docs/ImplementingASemanticCheck.md +++ b/flang/docs/ImplementingASemanticCheck.md @@ -67,7 +67,7 @@ I also used this program to produce a parse tree for the program using the command: ```bash - flang-new -fc1 -fdebug-dump-parse-tree testfun.f90 + flang -fc1 -fdebug-dump-parse-tree testfun.f90 ``` Here's the relevant fragment of the parse tree produced by the compiler: @@ -295,7 +295,7 @@ I then built the compiler with these changes and ran it on my test program. This time, I made sure to invoke semantic checking. Here's the command I used: ```bash - flang-new -fc1 -fdebug-unparse-with-symbols testfun.f90 + flang -fc1 -fdebug-unparse-with-symbols testfun.f90 ``` This produced the output: diff --git a/flang/docs/Overview.md b/flang/docs/Overview.md --- a/flang/docs/Overview.md +++ b/flang/docs/Overview.md @@ -64,8 +64,8 @@ **Entry point:** `parser::Parsing::Prescan` **Commands:** - - `flang-new -fc1 -E src.f90` dumps the cooked character stream - - `flang-new -fc1 -fdebug-dump-provenance src.f90` dumps provenance + - `flang -fc1 -E src.f90` dumps the cooked character stream + - `flang -fc1 -fdebug-dump-provenance src.f90` dumps provenance information ## Parsing @@ -79,10 +79,10 @@ **Entry point:** `parser::Parsing::Parse` **Commands:** - - `flang-new -fc1 -fdebug-dump-parse-tree-no-sema src.f90` dumps the parse tree - - `flang-new -fc1 -fdebug-unparse src.f90` converts the parse tree to normalized Fortran - - `flang-new -fc1 -fdebug-dump-parsing-log src.f90` runs an instrumented parse and dumps the log - - `flang-new -fc1 -fdebug-measure-parse-tree src.f90` measures the parse tree + - `flang -fc1 -fdebug-dump-parse-tree-no-sema src.f90` dumps the parse tree + - `flang -fc1 -fdebug-unparse src.f90` converts the parse tree to normalized Fortran + - `flang -fc1 -fdebug-dump-parsing-log src.f90` runs an instrumented parse and dumps the log + - `flang -fc1 -fdebug-measure-parse-tree src.f90` measures the parse tree ## Semantic processing @@ -120,9 +120,9 @@ At the end of semantic processing, all validation of the user's program is complete. This is the last detailed phase of analysis processing. **Commands:** - - `flang-new -fc1 -fdebug-dump-parse-tree src.f90` dumps the parse tree after semantic analysis - - `flang-new -fc1 -fdebug-dump-symbols src.f90` dumps the symbol table - - `flang-new -fc1 -fdebug-dump-all src.f90` dumps both the parse tree and the symbol table + - `flang -fc1 -fdebug-dump-parse-tree src.f90` dumps the parse tree after semantic analysis + - `flang -fc1 -fdebug-dump-symbols src.f90` dumps the symbol table + - `flang -fc1 -fdebug-dump-all src.f90` dumps both the parse tree and the symbol table # Lowering @@ -162,8 +162,8 @@ parse tree. The compiler walks the PFT generating FIR. **Commands:** - - `flang-new -fc1 -fdebug-dump-pft src.f90` dumps the pre-FIR tree - - `flang-new -fc1 -emit-mlir src.f90` dumps the FIR to the files src.mlir + - `flang -fc1 -fdebug-dump-pft src.f90` dumps the pre-FIR tree + - `flang -fc1 -emit-mlir src.f90` dumps the FIR to the files src.mlir ## Transformation passes @@ -179,8 +179,8 @@ LLVM IR representation of the program. **Commands:** - - `flang-new -mmlir --mlir-print-ir-after-all -S src.f90` dumps the FIR code after each pass to standard error - - `flang-new -fc1 -emit-llvm src.f90` dumps the LLVM IR to src.ll + - `flang -mmlir --mlir-print-ir-after-all -S src.f90` dumps the FIR code after each pass to standard error + - `flang -fc1 -emit-llvm src.f90` dumps the LLVM IR to src.ll # Object code generation and linking diff --git a/flang/examples/FlangOmpReport/FlangOmpReport.cpp b/flang/examples/FlangOmpReport/FlangOmpReport.cpp --- a/flang/examples/FlangOmpReport/FlangOmpReport.cpp +++ b/flang/examples/FlangOmpReport/FlangOmpReport.cpp @@ -9,7 +9,7 @@ // all the OpenMP constructs and clauses and which line they're located on. // // The plugin may be invoked as: -// ./bin/flang-new -fc1 -load lib/flangOmpReport.so -plugin flang-omp-report +// ./bin/flang -fc1 -load lib/flangOmpReport.so -plugin flang-omp-report // -fopenmp // //===----------------------------------------------------------------------===// diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -59,8 +59,8 @@ static bool parseShowColorsArgs(const llvm::opt::ArgList &args, bool defaultColor = true) { // Color diagnostics default to auto ("on" if terminal supports) in the - // compiler driver `flang-new` but default to off in the frontend driver - // `flang-new -fc1`, needing an explicit OPT_fdiagnostics_color. + // compiler driver `flang` but default to off in the frontend driver + // `flang -fc1`, needing an explicit OPT_fdiagnostics_color. // Support both clang's -f[no-]color-diagnostics and gcc's // -f[no-]diagnostics-colors[=never|always|auto]. enum { @@ -610,7 +610,7 @@ } } - // Default to off for `flang-new -fc1`. + // Default to off for `flang -fc1`. res.getFrontendOpts().showColors = parseShowColorsArgs(args, /*defaultDiagColor=*/false); diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp --- a/flang/lib/Frontend/FrontendActions.cpp +++ b/flang/lib/Frontend/FrontendActions.cpp @@ -108,7 +108,7 @@ llvm::SMDiagnostic err; llvmModule = llvm::parseIRFile(getCurrentInput().getFile(), err, *llvmCtx); if (!llvmModule || llvm::verifyModule(*llvmModule, &llvm::errs())) { - err.print("flang-new", llvm::errs()); + err.print("flang", llvm::errs()); unsigned diagID = ci.getDiagnostics().getCustomDiagID( clang::DiagnosticsEngine::Error, "Could not parse IR"); ci.getDiagnostics().Report(diagID); diff --git a/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp --- a/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -102,8 +102,7 @@ // Honor -help. if (flang->getFrontendOpts().showHelp) { clang::driver::getDriverOptTable().printHelp( - llvm::outs(), "flang-new -fc1 [options] file...", - "LLVM 'Flang' Compiler", + llvm::outs(), "flang -fc1 [options] file...", "LLVM 'Flang' Compiler", /*Include=*/clang::driver::options::FC1Option, /*Exclude=*/llvm::opt::DriverFlag::HelpHidden, /*ShowAllAliases=*/false); diff --git a/flang/test/CMakeLists.txt b/flang/test/CMakeLists.txt --- a/flang/test/CMakeLists.txt +++ b/flang/test/CMakeLists.txt @@ -48,7 +48,7 @@ flang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py) set(FLANG_TEST_DEPENDS - flang-new + flang llvm-config FileCheck count diff --git a/flang/test/Driver/color-diagnostics-forwarding.f90 b/flang/test/Driver/color-diagnostics-forwarding.f90 --- a/flang/test/Driver/color-diagnostics-forwarding.f90 +++ b/flang/test/Driver/color-diagnostics-forwarding.f90 @@ -1,5 +1,5 @@ -! Test that flang-new forwards -f{no-}color-diagnostics options to -! flang-new -fc1 as expected. +! Test that flang forwards -f{no-}color-diagnostics options to +! flang -fc1 as expected. ! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 -fcolor-diagnostics \ ! RUN: | FileCheck %s --check-prefix=CHECK-CD diff --git a/flang/test/Driver/convert.f90 b/flang/test/Driver/convert.f90 --- a/flang/test/Driver/convert.f90 +++ b/flang/test/Driver/convert.f90 @@ -12,7 +12,7 @@ ! RUN: not %flang -fconvert=foobar %s 2>&1 | FileCheck %s --check-prefix=INVALID !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: %flang_fc1 -emit-mlir -fconvert=unknown %s -o - | FileCheck %s --check-prefix=VALID_FC1 ! RUN: %flang_fc1 -emit-mlir -fconvert=native %s -o - | FileCheck %s --check-prefix=VALID_FC1 diff --git a/flang/test/Driver/disable-ext-name-interop.f90 b/flang/test/Driver/disable-ext-name-interop.f90 --- a/flang/test/Driver/disable-ext-name-interop.f90 +++ b/flang/test/Driver/disable-ext-name-interop.f90 @@ -1,4 +1,4 @@ -! Test that we can disable the ExternalNameConversion pass in flang-new. +! Test that we can disable the ExternalNameConversion pass in flang. ! RUN: %flang_fc1 -S %s -o - 2>&1 | FileCheck %s --check-prefix=EXTNAMES ! RUN: %flang_fc1 -S -mmlir -disable-external-name-interop %s -o - 2>&1 | FileCheck %s --check-prefix=INTNAMES diff --git a/flang/test/Driver/driver-help-hidden.f90 b/flang/test/Driver/driver-help-hidden.f90 --- a/flang/test/Driver/driver-help-hidden.f90 +++ b/flang/test/Driver/driver-help-hidden.f90 @@ -1,17 +1,17 @@ !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- ! RUN: %flang --help-hidden 2>&1 | FileCheck %s ! RUN: not %flang -help-hidden 2>&1 | FileCheck %s --check-prefix=ERROR-FLANG !---------------------------------------- -! FLANG FRONTEND DRIVER (flang-new -fc1) +! FLANG FRONTEND DRIVER (flang -fc1) !---------------------------------------- ! RUN: not %flang_fc1 --help-hidden 2>&1 | FileCheck %s --check-prefix=ERROR-FLANG-FC1 ! RUN: not %flang_fc1 -help-hidden 2>&1 | FileCheck %s --check-prefix=ERROR-FLANG-FC1 -! CHECK:USAGE: flang-new +! CHECK:USAGE: flang ! CHECK-EMPTY: ! CHECK-NEXT:OPTIONS: ! CHECK-NEXT: -### Print (but do not run) the commands to run for this compilation @@ -39,8 +39,6 @@ ! CHECK-NEXT: -finput-charset= Specify the default character set for source files ! CHECK-NEXT: -fintrinsic-modules-path ! CHECK-NEXT: Specify where to find the compiled intrinsic modules -! CHECK-NEXT: -flang-experimental-exec -! CHECK-NEXT: Enable support for generating executables (experimental) ! CHECK-NEXT: -flarge-sizes Use INTEGER(KIND=8) for the result type in size-related intrinsics ! CHECK-NEXT: -flogical-abbreviations Enable logical abbreviations ! CHECK-NEXT: -fno-automatic Implies the SAVE attribute for non-automatic local objects in subprograms unless RECURSIVE diff --git a/flang/test/Driver/driver-version.f90 b/flang/test/Driver/driver-version.f90 --- a/flang/test/Driver/driver-version.f90 +++ b/flang/test/Driver/driver-version.f90 @@ -4,12 +4,12 @@ ! RUN: %flang_fc1 -version 2>&1 | FileCheck %s --check-prefix=VERSION-FC1 ! RUN: not %flang_fc1 --version 2>&1 | FileCheck %s --check-prefix=ERROR-FC1 -! VERSION: flang-new version +! VERSION: flang version ! VERSION-NEXT: Target: ! VERSION-NEXT: Thread model: ! VERSION-NEXT: InstalledDir: -! ERROR: flang-new: error: unsupported option '--versions'; did you mean '--version'? +! ERROR: flang: error: unsupported option '--versions'; did you mean '--version'? ! VERSION-FC1: LLVM version diff --git a/flang/test/Driver/escaped-backslash.f90 b/flang/test/Driver/escaped-backslash.f90 --- a/flang/test/Driver/escaped-backslash.f90 +++ b/flang/test/Driver/escaped-backslash.f90 @@ -1,14 +1,14 @@ ! Ensure argument -fbackslash works as expected. !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- ! RUN: %flang -E %s 2>&1 | FileCheck %s --check-prefix=ESCAPED ! RUN: %flang -E -fbackslash -fno-backslash %s 2>&1 | FileCheck %s --check-prefix=ESCAPED ! RUN: %flang -E -fbackslash %s 2>&1 | FileCheck %s --check-prefix=UNESCAPED !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: %flang_fc1 -E %s 2>&1 | FileCheck %s --check-prefix=ESCAPED ! RUN: %flang_fc1 -E -fbackslash -fno-backslash %s 2>&1 | FileCheck %s --check-prefix=ESCAPED diff --git a/flang/test/Driver/fdefault.f90 b/flang/test/Driver/fdefault.f90 --- a/flang/test/Driver/fdefault.f90 +++ b/flang/test/Driver/fdefault.f90 @@ -2,25 +2,25 @@ ! TODO: Add checks when actual codegen is possible for this family !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang -fsyntax-only -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=NOOPTION -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang -fsyntax-only -fdefault-real-8 -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=REAL8 -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang -fsyntax-only -fdefault-real-8 -fdefault-double-8 -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=DOUBLE8 +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang -fsyntax-only -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=NOOPTION +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang -fsyntax-only -fdefault-real-8 -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=REAL8 +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang -fsyntax-only -fdefault-real-8 -fdefault-double-8 -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=DOUBLE8 ! RUN: not %flang -fsyntax-only -fdefault-double-8 %s 2>&1 | FileCheck %s --check-prefix=ERROR !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang_fc1 -fsyntax-only -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=NOOPTION -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang_fc1 -fsyntax-only -fdefault-real-8 -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=REAL8 -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang_fc1 -fsyntax-only -fdefault-real-8 -fdefault-double-8 -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=DOUBLE8 +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang_fc1 -fsyntax-only -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=NOOPTION +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang_fc1 -fsyntax-only -fdefault-real-8 -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=REAL8 +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang_fc1 -fsyntax-only -fdefault-real-8 -fdefault-double-8 -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=DOUBLE8 ! RUN: not %flang_fc1 -fsyntax-only -fdefault-double-8 %s 2>&1 | FileCheck %s --check-prefix=ERROR ! NOOPTION: integer(4),parameter::real_kind=4_4 diff --git a/flang/test/Driver/flarge-sizes.f90 b/flang/test/Driver/flarge-sizes.f90 --- a/flang/test/Driver/flarge-sizes.f90 +++ b/flang/test/Driver/flarge-sizes.f90 @@ -2,20 +2,20 @@ ! TODO: Add checks when actual codegen is possible. !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang -fsyntax-only -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=NOLARGE -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang -fsyntax-only -flarge-sizes -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=LARGE +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang -fsyntax-only -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=NOLARGE +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang -fsyntax-only -flarge-sizes -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=LARGE !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang_fc1 -fsyntax-only -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=NOLARGE -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang_fc1 -fsyntax-only -flarge-sizes -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=LARGE +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang_fc1 -fsyntax-only -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=NOLARGE +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang_fc1 -fsyntax-only -flarge-sizes -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=LARGE ! NOLARGE: real(4)::z(1_8:10_8) ! NOLARGE-NEXT: integer(4),parameter::size_kind=4_4 diff --git a/flang/test/Driver/frontend-forwarding.f90 b/flang/test/Driver/frontend-forwarding.f90 --- a/flang/test/Driver/frontend-forwarding.f90 +++ b/flang/test/Driver/frontend-forwarding.f90 @@ -1,5 +1,5 @@ -! Test that flang-new forwards Flang frontend -! options to flang-new -fc1 as expected. +! Test that flang forwards Flang frontend +! options to flang -fc1 as expected. ! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 \ ! RUN: -finput-charset=utf-8 \ diff --git a/flang/test/Driver/intrinsic-module-path.f90 b/flang/test/Driver/intrinsic-module-path.f90 --- a/flang/test/Driver/intrinsic-module-path.f90 +++ b/flang/test/Driver/intrinsic-module-path.f90 @@ -4,7 +4,7 @@ ! default one, causing a CHECKSUM error. !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT ! RUN: not %flang_fc1 -fsyntax-only -fintrinsic-modules-path %S/Inputs/ %s 2>&1 | FileCheck %s --check-prefix=GIVEN diff --git a/flang/test/Driver/linker-flags.f90 b/flang/test/Driver/linker-flags.f90 --- a/flang/test/Driver/linker-flags.f90 +++ b/flang/test/Driver/linker-flags.f90 @@ -2,15 +2,15 @@ ! invocation. These libraries are added on top of other standard runtime ! libraries that the Clang driver will include. -! RUN: %flang -### -flang-experimental-exec -target ppc64le-linux-gnu %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,GNU -! RUN: %flang -### -flang-experimental-exec -target aarch64-apple-darwin %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,DARWIN -! RUN: %flang -### -flang-experimental-exec -target x86_64-windows-gnu %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,MINGW +! RUN: %flang -### -target ppc64le-linux-gnu %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,GNU +! RUN: %flang -### -target aarch64-apple-darwin %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,DARWIN +! RUN: %flang -### -target x86_64-windows-gnu %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,MINGW ! NOTE: Clang's driver library, clangDriver, usually adds 'libcmt' and ! 'oldnames' on Windows, but they are not needed when compiling ! Fortran code and they might bring in additional dependencies. ! Make sure they're not added. -! RUN: %flang -### -flang-experimental-exec -target aarch64-windows-msvc %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,MSVC --implicit-check-not libcmt --implicit-check-not oldnames +! RUN: %flang -### -target aarch64-windows-msvc %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,MSVC --implicit-check-not libcmt --implicit-check-not oldnames ! Compiler invocation to generate the object file ! CHECK-LABEL: {{.*}} "-emit-obj" diff --git a/flang/test/Driver/macro-def-undef.F90 b/flang/test/Driver/macro-def-undef.F90 --- a/flang/test/Driver/macro-def-undef.F90 +++ b/flang/test/Driver/macro-def-undef.F90 @@ -1,14 +1,14 @@ ! Ensure arguments -D and -U work as expected. !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- ! RUN: %flang -E -P %s 2>&1 | FileCheck %s --check-prefix=UNDEFINED ! RUN: %flang -E -P -DX=A %s 2>&1 | FileCheck %s --check-prefix=DEFINED ! RUN: %flang -E -P -DX=A -UX %s 2>&1 | FileCheck %s --check-prefix=UNDEFINED !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: %flang_fc1 -E -P %s 2>&1 | FileCheck %s --check-prefix=UNDEFINED ! RUN: %flang_fc1 -E -P -DX=A %s 2>&1 | FileCheck %s --check-prefix=DEFINED diff --git a/flang/test/Driver/missing-input.f90 b/flang/test/Driver/missing-input.f90 --- a/flang/test/Driver/missing-input.f90 +++ b/flang/test/Driver/missing-input.f90 @@ -1,26 +1,26 @@ ! Test the behaviour of the driver when input is missing or is invalid. Note -! that with the compiler driver (flang-new), the input _has_ to be specified. +! that with the compiler driver (flang), the input _has_ to be specified. ! Indeed, the driver decides what "job/command" to create based on the input ! file's extension. No input file means that it doesn't know what to do -! (compile? preprocess? link?). The frontend driver (flang-new -fc1) simply +! (compile? preprocess? link?). The frontend driver (flang -fc1) simply ! assumes that "no explicit input == read from stdin" !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- ! RUN: not %flang 2>&1 | FileCheck %s --check-prefix=FLANG-NO-FILE ! RUN: not %flang %t.f90 2>&1 | FileCheck %s --check-prefix=FLANG-NONEXISTENT-FILE !----------------------------------------- -! FLANG FRONTEND DRIVER (flang-new -fc1) +! FLANG FRONTEND DRIVER (flang -fc1) !----------------------------------------- ! RUN: not %flang_fc1 %t.f90 2>&1 | FileCheck %s --check-prefix=FLANG-FC1-NONEXISTENT-FILE ! RUN: not %flang_fc1 %S 2>&1 | FileCheck %s --check-prefix=FLANG-FC1-DIR -! FLANG-NO-FILE: flang-new: error: no input files +! FLANG-NO-FILE: flang: error: no input files -! FLANG-NONEXISTENT-FILE: flang-new: error: no such file or directory: {{.*}} -! FLANG-NONEXISTENT-FILE: flang-new: error: no input files +! FLANG-NONEXISTENT-FILE: flang: error: no such file or directory: {{.*}} +! FLANG-NONEXISTENT-FILE: flang: error: no input files ! FLANG-FC1-NONEXISTENT-FILE: error: {{.*}} does not exist ! FLANG-FC1-DIR: error: {{.*}} is not a regular file diff --git a/flang/test/Driver/multiple-input-files.f90 b/flang/test/Driver/multiple-input-files.f90 --- a/flang/test/Driver/multiple-input-files.f90 +++ b/flang/test/Driver/multiple-input-files.f90 @@ -39,7 +39,7 @@ ! FLANG-NEXT:end program hello ! TEST 2: `-o` does not when multiple input files are present -! ERROR: flang-new: error: cannot specify -o when generating multiple output files +! ERROR: flang: error: cannot specify -o when generating multiple output files ! TEST 3: The output file _was not_ specified - `flang_fc1` will process all ! input files and generate one output file for every input file. diff --git a/flang/test/Driver/predefined-macros-compiler-version.F90 b/flang/test/Driver/predefined-macros-compiler-version.F90 --- a/flang/test/Driver/predefined-macros-compiler-version.F90 +++ b/flang/test/Driver/predefined-macros-compiler-version.F90 @@ -1,12 +1,12 @@ ! Check that the driver correctly defines macros with the compiler version !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- ! RUN: %flang_fc1 -E %s 2>&1 | FileCheck %s --ignore-case !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: %flang_fc1 -E %s 2>&1 | FileCheck %s --ignore-case diff --git a/flang/test/Driver/std2018-wrong.f90 b/flang/test/Driver/std2018-wrong.f90 --- a/flang/test/Driver/std2018-wrong.f90 +++ b/flang/test/Driver/std2018-wrong.f90 @@ -1,7 +1,7 @@ ! Ensure argument -std=f2018 works as expected. !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: not %flang_fc1 -std=90 %s 2>&1 | FileCheck %s --check-prefix=WRONG diff --git a/flang/test/Driver/std2018.f90 b/flang/test/Driver/std2018.f90 --- a/flang/test/Driver/std2018.f90 +++ b/flang/test/Driver/std2018.f90 @@ -1,7 +1,7 @@ ! Ensure argument -std=f2018 works as expected. !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT ! RUN: %flang_fc1 -fsyntax-only -std=f2018 %s 2>&1 | FileCheck %s --check-prefix=GIVEN diff --git a/flang/test/Driver/use-module-error.f90 b/flang/test/Driver/use-module-error.f90 --- a/flang/test/Driver/use-module-error.f90 +++ b/flang/test/Driver/use-module-error.f90 @@ -1,14 +1,14 @@ ! Ensure that multiple module directories are not allowed !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- ! RUN: not %flang -fsyntax-only -J %S/Inputs/module-dir -J %S/Inputs/ %s 2>&1 | FileCheck %s --check-prefix=DOUBLEINCLUDE ! RUN: not %flang -fsyntax-only -J %S/Inputs/module-dir -module-dir %S/Inputs/ %s 2>&1 | FileCheck %s --check-prefix=DOUBLEINCLUDE ! RUN: not %flang -fsyntax-only -module-dir %S/Inputs/module-dir -J%S/Inputs/ %s 2>&1 | FileCheck %s --check-prefix=DOUBLEINCLUDE !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: not %flang_fc1 -fsyntax-only -J %S/Inputs/module-dir -J %S/Inputs/ %s 2>&1 | FileCheck %s --check-prefix=DOUBLEINCLUDE ! RUN: not %flang_fc1 -fsyntax-only -J %S/Inputs/module-dir -module-dir %S/Inputs/ %s 2>&1 | FileCheck %s --check-prefix=DOUBLEINCLUDE diff --git a/flang/test/Driver/use-module.f90 b/flang/test/Driver/use-module.f90 --- a/flang/test/Driver/use-module.f90 +++ b/flang/test/Driver/use-module.f90 @@ -1,7 +1,7 @@ ! Checks that module search directories specified with `-J/-module-dir` and `-I` are handled correctly !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- ! RUN: %flang -fsyntax-only -I %S/Inputs -I %S/Inputs/module-dir %s 2>&1 | FileCheck %s --check-prefix=INCLUDED --allow-empty ! RUN: %flang -fsyntax-only -I %S/Inputs -J %S/Inputs/module-dir %s 2>&1 | FileCheck %s --check-prefix=INCLUDED --allow-empty @@ -16,7 +16,7 @@ ! RUN: not %flang -fsyntax-only -module-dir %S/Inputs/module-dir %s 2>&1 | FileCheck %s --check-prefix=SINGLEINCLUDE !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: %flang_fc1 -fsyntax-only -I %S/Inputs -I %S/Inputs/module-dir %s 2>&1 | FileCheck %s --check-prefix=INCLUDED --allow-empty ! RUN: %flang_fc1 -fsyntax-only -I %S/Inputs -J %S/Inputs/module-dir %s 2>&1 | FileCheck %s --check-prefix=INCLUDED --allow-empty diff --git a/flang/test/Lower/Intrinsics/command_argument_count.f90 b/flang/test/Lower/Intrinsics/command_argument_count.f90 --- a/flang/test/Lower/Intrinsics/command_argument_count.f90 +++ b/flang/test/Lower/Intrinsics/command_argument_count.f90 @@ -1,6 +1,6 @@ ! RUN: bbc -emit-fir %s -o - | FileCheck %s -! bbc doesn't have a way to set the default kinds so we use flang-new driver -! RUN: flang-new -fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 %s +! bbc doesn't have a way to set the default kinds so we use flang driver +! RUN: %flang_fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 %s ! CHECK-LABEL: argument_count_test subroutine argument_count_test() diff --git a/flang/test/Lower/Intrinsics/exit.f90 b/flang/test/Lower/Intrinsics/exit.f90 --- a/flang/test/Lower/Intrinsics/exit.f90 +++ b/flang/test/Lower/Intrinsics/exit.f90 @@ -1,6 +1,6 @@ ! RUN: bbc -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-32 -DDEFAULT_INTEGER_SIZE=32 %s -! bbc doesn't have a way to set the default kinds so we use flang-new driver -! RUN: flang-new -fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 -DDEFAULT_INTEGER_SIZE=64 %s +! bbc doesn't have a way to set the default kinds so we use flang driver +! RUN: %flang_fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 -DDEFAULT_INTEGER_SIZE=64 %s ! CHECK-LABEL: func @_QPexit_test1() { subroutine exit_test1 diff --git a/flang/test/Lower/Intrinsics/get_command_argument.f90 b/flang/test/Lower/Intrinsics/get_command_argument.f90 --- a/flang/test/Lower/Intrinsics/get_command_argument.f90 +++ b/flang/test/Lower/Intrinsics/get_command_argument.f90 @@ -1,5 +1,5 @@ ! RUN: bbc -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-32 -DDEFAULT_INTEGER_SIZE=32 %s -! RUN: flang-new -fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 -DDEFAULT_INTEGER_SIZE=64 %s +! RUN: %flang_fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 -DDEFAULT_INTEGER_SIZE=64 %s ! CHECK-LABEL: func @_QPnumber_only( ! CHECK-SAME: %[[num:.*]]: !fir.ref{{.*}}) { diff --git a/flang/test/Lower/Intrinsics/get_environment_variable.f90 b/flang/test/Lower/Intrinsics/get_environment_variable.f90 --- a/flang/test/Lower/Intrinsics/get_environment_variable.f90 +++ b/flang/test/Lower/Intrinsics/get_environment_variable.f90 @@ -1,5 +1,5 @@ ! RUN: bbc -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-32 -DDEFAULT_INTEGER_SIZE=32 %s -! RUN: flang-new -fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 -DDEFAULT_INTEGER_SIZE=64 %s +! RUN: %flang_fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 -DDEFAULT_INTEGER_SIZE=64 %s ! CHECK-LABEL: func @_QPname_only( ! CHECK-SAME: %[[nameArg:.*]]: !fir.boxchar<1> {fir.bindc_name = "name"}) { diff --git a/flang/test/Lower/Intrinsics/move_alloc.f90 b/flang/test/Lower/Intrinsics/move_alloc.f90 --- a/flang/test/Lower/Intrinsics/move_alloc.f90 +++ b/flang/test/Lower/Intrinsics/move_alloc.f90 @@ -1,5 +1,5 @@ ! RUN: bbc -emit-fir %s -o - | FileCheck %s - ! RUN: flang-new -fc1 -emit-fir %s -o - | FileCheck %s + ! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s ! CHECK-LABEL: to_from_only subroutine to_from_only diff --git a/flang/test/Lower/OpenACC/Todo/acc-declare.f90 b/flang/test/Lower/OpenACC/Todo/acc-declare.f90 --- a/flang/test/Lower/OpenACC/Todo/acc-declare.f90 +++ b/flang/test/Lower/OpenACC/Todo/acc-declare.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of OpenACC declare Directive. -// RUN: not flang-new -fc1 -emit-fir -fopenacc %s 2>&1 | FileCheck %s +// RUN: not %flang_fc1 -emit-fir -fopenacc %s 2>&1 | FileCheck %s program main real, dimension(10) :: aa, bb diff --git a/flang/test/Lower/OpenACC/Todo/acc-routine.f90 b/flang/test/Lower/OpenACC/Todo/acc-routine.f90 --- a/flang/test/Lower/OpenACC/Todo/acc-routine.f90 +++ b/flang/test/Lower/OpenACC/Todo/acc-routine.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of OpenACC routine Directive. -// RUN: not flang-new -fc1 -emit-fir -fopenacc %s 2>&1 | FileCheck %s +// RUN: not %flang_fc1 -emit-fir -fopenacc %s 2>&1 | FileCheck %s program main // CHECK: not yet implemented: OpenACC Routine construct not lowered yet! diff --git a/flang/test/Lower/OpenMP/Todo/omp-declarative-allocate.f90 b/flang/test/Lower/OpenMP/Todo/omp-declarative-allocate.f90 --- a/flang/test/Lower/OpenMP/Todo/omp-declarative-allocate.f90 +++ b/flang/test/Lower/OpenMP/Todo/omp-declarative-allocate.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of OpenMP allocate Directive. -// RUN: not flang-new -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s +// RUN: not %flang_fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s program main integer :: x, y diff --git a/flang/test/Lower/OpenMP/Todo/omp-declare-reduction.f90 b/flang/test/Lower/OpenMP/Todo/omp-declare-reduction.f90 --- a/flang/test/Lower/OpenMP/Todo/omp-declare-reduction.f90 +++ b/flang/test/Lower/OpenMP/Todo/omp-declare-reduction.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of OpenMP declare reduction Directive. -// RUN: not flang-new -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s +// RUN: not %flang_fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s subroutine declare_red() integer :: my_var diff --git a/flang/test/Lower/OpenMP/Todo/omp-declare-simd.f90 b/flang/test/Lower/OpenMP/Todo/omp-declare-simd.f90 --- a/flang/test/Lower/OpenMP/Todo/omp-declare-simd.f90 +++ b/flang/test/Lower/OpenMP/Todo/omp-declare-simd.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of OpenMP declare simd Directive. -// RUN: not flang-new -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s +// RUN: not %flang_fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s subroutine sub(x, y) real, intent(inout) :: x, y diff --git a/flang/test/Lower/OpenMP/Todo/omp-declare-target.f90 b/flang/test/Lower/OpenMP/Todo/omp-declare-target.f90 --- a/flang/test/Lower/OpenMP/Todo/omp-declare-target.f90 +++ b/flang/test/Lower/OpenMP/Todo/omp-declare-target.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of OpenMP declare target Directive. -// RUN: not flang-new -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s +// RUN: not %flang_fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s module mod1 contains diff --git a/flang/test/Lower/OpenMP/omp-parallel-lastprivate-clause-scalar.f90 b/flang/test/Lower/OpenMP/omp-parallel-lastprivate-clause-scalar.f90 --- a/flang/test/Lower/OpenMP/omp-parallel-lastprivate-clause-scalar.f90 +++ b/flang/test/Lower/OpenMP/omp-parallel-lastprivate-clause-scalar.f90 @@ -1,7 +1,7 @@ ! This test checks lowering of `FIRSTPRIVATE` clause for scalar types. ! RUN: bbc -fopenmp -emit-fir %s -o - | FileCheck %s -! RUN: flang-new -fc1 -fopenmp -emit-fir %s -o - | FileCheck %s +! RUN: %flang_fc1 -fopenmp -emit-fir %s -o - | FileCheck %s !CHECK: func @_QPlastprivate_character(%[[ARG1:.*]]: !fir.boxchar<1>{{.*}}) { !CHECK-DAG: %[[ARG1_UNBOX:.*]]:2 = fir.unboxchar diff --git a/flang/test/lit.cfg.py b/flang/test/lit.cfg.py --- a/flang/test/lit.cfg.py +++ b/flang/test/lit.cfg.py @@ -90,8 +90,8 @@ # For each occurrence of a flang tool name, replace it with the full path to # the build directory holding that tool. tools = [ - ToolSubst('%flang', command=FindTool('flang-new'), unresolved='fatal'), - ToolSubst('%flang_fc1', command=FindTool('flang-new'), extra_args=['-fc1'], + ToolSubst('%flang', command=FindTool('flang'), unresolved='fatal'), + ToolSubst('%flang_fc1', command=FindTool('flang'), extra_args=['-fc1'], unresolved='fatal')] # Flang has several unimplemented features. TODO messages are used to mark and fail if these diff --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt --- a/flang/tools/f18/CMakeLists.txt +++ b/flang/tools/f18/CMakeLists.txt @@ -19,7 +19,7 @@ ) # Create module files directly from the top-level module source directory. -# If CMAKE_CROSSCOMPILING, then the newly built flang-new executable was +# If CMAKE_CROSSCOMPILING, then the newly built flang executable was # cross compiled, and thus can't be executed on the build system and thus # can't be used for generating module files. if (NOT CMAKE_CROSSCOMPILING) @@ -39,9 +39,9 @@ endif() add_custom_command(OUTPUT ${base}.mod COMMAND ${CMAKE_COMMAND} -E make_directory ${FLANG_INTRINSIC_MODULES_DIR} - COMMAND flang-new -fc1 -cpp -fsyntax-only -module-dir ${FLANG_INTRINSIC_MODULES_DIR} + COMMAND flang -fc1 -cpp -fsyntax-only -module-dir ${FLANG_INTRINSIC_MODULES_DIR} ${FLANG_SOURCE_DIR}/module/${filename}.f90 - DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends} + DEPENDS flang ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends} ) add_custom_command(OUTPUT ${base}.f18.mod DEPENDS ${base}.mod diff --git a/flang/tools/f18/flang-to-external-fc.in b/flang/tools/f18/flang-to-external-fc.in --- a/flang/tools/f18/flang-to-external-fc.in +++ b/flang/tools/f18/flang-to-external-fc.in @@ -205,7 +205,7 @@ if # The options claimed by Flang. This list needs to be compatible with - # what's supported by Flang's compiler driver (i.e. `flang-new`). + # what's supported by Flang's compiler driver (i.e. `flang`). [[ $opt == "-cpp" ]] || [[ $opt =~ ^-D.* ]] || [[ $opt == "-E" ]] || @@ -232,7 +232,7 @@ [[ $opt == "-Werror" ]]; then flang_opts+=($opt) elif - # We translate the following into equivalents understood by `flang-new` + # We translate the following into equivalents understood by `flang` [[ $opt == "-Mfixed" ]] || [[ $opt == "-Mfree" ]]; then case $opt in -Mfixed) @@ -244,7 +244,7 @@ ;; *) - echo "ERROR: $opt has no equivalent in 'flang-new'" + echo "ERROR: $opt has no equivalent in 'flang'" exit 1 ;; esac @@ -305,9 +305,9 @@ # Preprocess fortran sources using Flang for idx in "${!fortran_srcs[@]}"; do - if ! "$wd/bin/flang-new" -E "${opts[@]}" "${fortran_srcs[$idx]}" ${output_definition:+$output_definition} + if ! "$wd/bin/flang" -E "${opts[@]}" "${fortran_srcs[$idx]}" ${output_definition:+$output_definition} then status=$? - echo flang: in "$PWD", flang-new failed with exit status $status: "$wd/bin/flang-new" "${opts[@]}" "$@" >&2 + echo flang: in "$PWD", flang failed with exit status $status: "$wd/bin/flang" "${opts[@]}" "$@" >&2 exit $status fi done @@ -316,7 +316,7 @@ for idx in "${!other_srcs[@]}"; do if ! $ext_fc -E "${opts[@]}" "${other_srcs[$idx]}" ${output_definition:+$output_definition} then status=$? - echo flang: in "$PWD", flang-new failed with exit status $status: "$wd/bin/flang-new" "${opts[@]}" "$@" >&2 + echo flang: in "$PWD", flang failed with exit status $status: "$wd/bin/flang" "${opts[@]}" "$@" >&2 exit $status fi done @@ -408,11 +408,11 @@ [[ ! -z ${INTRINSICS_MOD_DIR} ]] && flang_options+=("-intrinsics-module-directory ${INTRINSICS_MOD_DIR}") for idx in "${!fortran_source_files[@]}"; do set +e - "$wd/bin/flang-new" "${flang_options[@]}" "${fortran_source_files[$idx]}" -o "${unparsed_file_base}_${idx}.f90" + "$wd/bin/flang" "${flang_options[@]}" "${fortran_source_files[$idx]}" -o "${unparsed_file_base}_${idx}.f90" ret_status=$? set -e if [[ $ret_status != 0 ]]; then - echo flang: in "$PWD", flang-new failed with exit status "$ret_status": "$wd/bin/flang-new" "${flang_options[@]}" "$@" >&2 + echo flang: in "$PWD", flang failed with exit status "$ret_status": "$wd/bin/flang" "${flang_options[@]}" "$@" >&2 exit "$ret_status" fi done diff --git a/flang/tools/flang-driver/CMakeLists.txt b/flang/tools/flang-driver/CMakeLists.txt --- a/flang/tools/flang-driver/CMakeLists.txt +++ b/flang/tools/flang-driver/CMakeLists.txt @@ -11,7 +11,7 @@ TargetParser ) -add_flang_tool(flang-new +add_flang_tool(flang driver.cpp fc1_main.cpp @@ -24,13 +24,13 @@ Fortran_main ) -target_link_libraries(flang-new +target_link_libraries(flang PRIVATE flangFrontend flangFrontendTool ) -clang_target_link_libraries(flang-new +clang_target_link_libraries(flang PRIVATE clangDriver clangBasic @@ -38,9 +38,9 @@ option(FLANG_PLUGIN_SUPPORT "Build Flang with plugin support." ON) -# Enable support for plugins, which need access to symbols from flang-new +# Enable support for plugins, which need access to symbols from flang if(FLANG_PLUGIN_SUPPORT) - export_executable_symbols_for_plugins(flang-new) + export_executable_symbols_for_plugins(flang) endif() -install(TARGETS flang-new DESTINATION "${CMAKE_INSTALL_BINDIR}") +install(TARGETS flang DESTINATION "${CMAKE_INSTALL_BINDIR}") diff --git a/flang/tools/flang-driver/driver.cpp b/flang/tools/flang-driver/driver.cpp --- a/flang/tools/flang-driver/driver.cpp +++ b/flang/tools/flang-driver/driver.cpp @@ -88,14 +88,15 @@ llvm::InitLLVM x(argc, argv); llvm::SmallVector args(argv, argv + argc); - clang::driver::ParsedClangName targetandMode("flang", "--driver-mode=flang"); + clang::driver::ParsedClangName targetandMode = + clang::driver::ToolChain::getTargetAndModeFromProgramName(argv[0]); std::string driverPath = getExecutablePath(args[0]); llvm::BumpPtrAllocator a; llvm::StringSaver saver(a); ExpandResponseFiles(saver, args); - // Check if flang-new is in the frontend mode + // Check if flang is in the frontend mode auto firstArg = std::find_if(args.begin() + 1, args.end(), [](const char *a) { return a != nullptr; }); if (firstArg != args.end()) { @@ -104,7 +105,7 @@ << "Valid tools include '-fc1'.\n"; return 1; } - // Call flang-new frontend + // Call flang frontend if (llvm::StringRef(args[1]).startswith("-fc1")) { return executeFC1Tool(args); }