[flang] don't require -flang-experimental-exec flag anymore

Reviewed By: awarzynski, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D153379
This commit is contained in:
Brad Richardson 2023-02-08 10:13:12 -06:00 committed by Katherine Rasmussen
parent 116b5e1eb4
commit 0867d41573
5 changed files with 6 additions and 26 deletions

View File

@ -5279,10 +5279,6 @@ def fno_sycl : Flag<["-"], "fno-sycl">, Flags<[NoXarchOption, CoreOption]>,
// FLangOption + NoXarchOption
//===----------------------------------------------------------------------===//
def flang_experimental_exec : Flag<["-"], "flang-experimental-exec">,
Flags<[FlangOption, FlangOnlyOption, NoXarchOption, HelpHidden]>,
HelpText<"Enable support for generating executables (experimental)">;
def flang_experimental_hlfir : Flag<["-"], "flang-experimental-hlfir">,
Flags<[FlangOption, FC1Option, FlangOnlyOption, NoXarchOption, HelpHidden]>,
HelpText<"Use HLFIR lowering (experimental)">;

View File

@ -935,12 +935,6 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC,
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 <driver-path>/../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

View File

@ -149,11 +149,6 @@ flang-new -ccc-print-phases -c file.f
+- 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.
@ -330,16 +325,13 @@ As of [#7246](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7246)
supported Fortran compiler. You can configure your CMake projects to use
`flang-new` as follows:
```bash
cmake -DCMAKE_Fortran_FLAGS="-flang-experimental-exec" -DCMAKE_Fortran_COMPILER=<path/to/flang-new> <src/dir>
cmake -DCMAKE_Fortran_COMPILER=<path/to/flang-new> <src/dir>
```
You should see the following in the output:
```
-- The Fortran compiler identification is LLVMFlang <version>
```
where `<version>` 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 `<version>` corresponds to the LLVM Flang version.
# Testing
In LIT, we define two variables that you can use to invoke Flang's drivers:

View File

@ -39,8 +39,6 @@
! CHECK-NEXT: -finput-charset=<value> Specify the default character set for source files
! CHECK-NEXT: -fintrinsic-modules-path <dir>
! 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: -flang-experimental-hlfir
! CHECK-NEXT: Use HLFIR lowering (experimental)
! CHECK-NEXT: -flarge-sizes Use INTEGER(KIND=8) for the result type in size-related intrinsics

View File

@ -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"