2020-10-24 19:33:19 +08:00
|
|
|
|
|
|
|
!--------------------------
|
|
|
|
! FLANG DRIVER (flang-new)
|
|
|
|
!--------------------------
|
2021-04-09 18:32:31 +08:00
|
|
|
! RUN: %flang --help-hidden 2>&1 | FileCheck %s
|
|
|
|
! RUN: not %flang -help-hidden 2>&1 | FileCheck %s --check-prefix=ERROR-FLANG
|
2020-10-24 19:33:19 +08:00
|
|
|
|
|
|
|
!----------------------------------------
|
|
|
|
! FLANG FRONTEND DRIVER (flang-new -fc1)
|
|
|
|
!----------------------------------------
|
2021-04-09 18:32:31 +08:00
|
|
|
! 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
|
2020-10-24 19:33:19 +08:00
|
|
|
|
|
|
|
!----------------------------------------------------
|
|
|
|
! EXPECTED OUTPUT FOR FLANG DRIVER (flang-new)
|
|
|
|
!----------------------------------------------------
|
|
|
|
! CHECK:USAGE: flang-new
|
|
|
|
! CHECK-EMPTY:
|
|
|
|
! CHECK-NEXT:OPTIONS:
|
2020-11-11 16:45:54 +08:00
|
|
|
! CHECK-NEXT: -### Print (but do not run) the commands to run for this compilation
|
2021-04-07 19:42:37 +08:00
|
|
|
! CHECK-NEXT: -cpp Enable predefined and command line preprocessor macros
|
[flang][driver] Add support for `-c` and `-emit-obj`
This patch adds a frontend action for emitting object files. While Flang
does not support code-generation, this action remains a placeholder.
This patch simply provides glue-code to connect the compiler driver
with the appropriate frontend action.
The new action is triggered with the `-c` compiler driver flag, i.e.
`flang-new -c`. This is then translated to `flang-new -fc1 -emit-obj`,
so `-emit-obj` has to be marked as supported as well.
As code-generation is not available yet, `flang-new -c` results in a
driver error:
```
error: code-generation is not available yet
```
Hopefully this will help communicating the level of available
functionality within Flang.
The definition of `emit-obj` is updated so that it can be shared between
Clang and Flang. As the original definition was enclosed within a
Clang-specific TableGen `let` statement, it is extracted into a new `let`
statement. That felt like the cleanest option.
I also commented out `-triple` in Flang::ConstructJob and updated some
comments there. This is similar to https://reviews.llvm.org/D93027. I
wanted to make sure that it's clear that we can't support `-triple`
until we have code-generation. However, once code-generation is
available we _will need_ `-triple`.
As this patch adds `-emit-obj`, the emit-obj.f90 becomes irrelevant and
is deleted. Instead, phases.f90 is added to demonstrate that users can
control compilation phases (indeed, `-c` is a phase control flag).
Reviewed By: SouraVX, clementval
Differential Revision: https://reviews.llvm.org/D93301
2021-01-07 17:08:54 +08:00
|
|
|
! CHECK-NEXT: -c Only run preprocess, compile, and assemble steps
|
2021-01-06 23:42:24 +08:00
|
|
|
! CHECK-NEXT: -D <macro>=<value> Define <macro> to <value> (or 1 if <value> omitted)
|
2020-10-27 20:26:47 +08:00
|
|
|
! CHECK-NEXT: -E Only run the preprocessor
|
2021-02-05 05:11:22 +08:00
|
|
|
! CHECK-NEXT: -falternative-parameter-statement
|
|
|
|
! CHECK-NEXT: Enable the old style PARAMETER statement
|
|
|
|
! CHECK-NEXT: -fbackslash Specify that backslash in string introduces an escape character
|
2020-10-24 19:33:19 +08:00
|
|
|
! CHECK-NEXT: -fcolor-diagnostics Enable colors in diagnostics
|
2021-03-04 00:28:11 +08:00
|
|
|
! CHECK-NEXT: -fdefault-double-8 Set the default double precision kind to an 8 byte wide type
|
|
|
|
! CHECK-NEXT: -fdefault-integer-8 Set the default integer kind to an 8 byte wide type
|
|
|
|
! CHECK-NEXT: -fdefault-real-8 Set the default real kind to an 8 byte wide type
|
2021-01-27 00:27:30 +08:00
|
|
|
! CHECK-NEXT: -ffixed-form Process source files in fixed form
|
|
|
|
! CHECK-NEXT: -ffixed-line-length=<value>
|
|
|
|
! CHECK-NEXT: Use <value> as character line width in fixed mode
|
|
|
|
! CHECK-NEXT: -ffree-form Process source files in free form
|
2021-02-05 05:11:22 +08:00
|
|
|
! CHECK-NEXT: -fimplicit-none No implicit typing allowed unless overridden by IMPLICIT statements
|
|
|
|
! CHECK-NEXT: -finput-charset=<value> Specify the default character set for source files
|
2021-03-24 00:24:57 +08:00
|
|
|
! CHECK-NEXT: -fintrinsic-modules-path <dir>
|
|
|
|
! CHECK-NEXT: Specify where to find the compiled intrinsic modules
|
2021-03-04 00:28:11 +08:00
|
|
|
! CHECK-NEXT: -flarge-sizes Use INTEGER(KIND=8) for the result type in size-related intrinsics
|
2021-02-05 05:11:22 +08:00
|
|
|
! CHECK-NEXT: -flogical-abbreviations Enable logical abbreviations
|
[flang][driver] Refactor boolean options
For boolean options, e.g. `-fxor-operator`/`-fno-xor-operator`, we ought
to be using TableGen multi-classes. This way, we only have to write one
definition to have both forms auto-generated. This patch refactors all
of Flang's boolean options to use two new multi-classes:
`OptInFC1FFOption` and `OptOutFC1FFOption`. These multi-classes are
based on `OptInFFOption`/`OptOutFFOption`, respectively. I've also
simplified the processing of the updated options in
CompilerInvocation.cpp.
With the new approach, "empty" help text (i.e. no `HelpText`) is now
replaced with an empty string (i.e. HelpText<"">). When running
flang-new --help, that's considered as non-empty help messages, which is
then printed (that's controlled by `printHelp` from
llvm/lib/Option/OptTable.cpp). This means that with this patch,
flang-new --help will start printing e.g. -fno-backslash, even though
there is no actual help text to print for this option (apart from the
empty string ""). Tests are updated accordingly.
Note that with this patch, both `-fxor-operator` and `-fno-xor-operator`
(and other boolean options refactored here) remain available in
`flang-new` and `flang-new -fc1`. In this respect, nothing changes. In a
forthcoming patch, I will refine this so that `flang-new -fc1` only
accepts `-ffoo` (`OptInFC1FFOption`) or `-fno-foo` (`OptOutCC1FFOption`).
For clarity, `OptInFFOption`/`OptOutFFOption` are renamed as
`OptInCC1FFOption`/`OptOutCC1FFOption`, respectively. Otherwise, this is
an NFC from Clang's perspective.
Differential Revision: https://reviews.llvm.org/D105881
2021-06-30 18:57:48 +08:00
|
|
|
! CHECK-NEXT: -fno-color-diagnostics Disable colors in diagnostics
|
2021-02-10 17:24:45 +08:00
|
|
|
! CHECK-NEXT: -fopenacc Enable OpenACC
|
|
|
|
! CHECK-NEXT: -fopenmp Parse OpenMP pragmas and generate parallel code.
|
2021-02-05 05:11:22 +08:00
|
|
|
! CHECK-NEXT: -fxor-operator Enable .XOR. as a synonym of .NEQV.
|
2020-10-24 19:33:19 +08:00
|
|
|
! CHECK-NEXT: -help Display available options
|
2021-01-19 18:01:38 +08:00
|
|
|
! CHECK-NEXT: -I <dir> Add directory to the end of the list of include search paths
|
2021-02-05 00:13:04 +08:00
|
|
|
! CHECK-NEXT: -module-dir <dir> Put MODULE files in <dir>
|
2021-04-07 19:42:37 +08:00
|
|
|
! CHECK-NEXT: -nocpp Disable predefined and command line preprocessor macros
|
2020-10-24 19:33:19 +08:00
|
|
|
! CHECK-NEXT: -o <file> Write output to <file>
|
2021-03-26 01:02:05 +08:00
|
|
|
! CHECK-NEXT: -pedantic Warn on language extensions
|
2021-07-24 07:41:04 +08:00
|
|
|
! CHECK-NEXT: -P Disable linemarker output in -E mode
|
2021-03-26 01:02:05 +08:00
|
|
|
! CHECK-NEXT: -std=<value> Language standard to compile for
|
2021-01-06 23:42:24 +08:00
|
|
|
! CHECK-NEXT: -U <macro> Undefine macro <macro>
|
2020-10-24 19:33:19 +08:00
|
|
|
! CHECK-NEXT: --version Print version information
|
2021-04-06 00:41:46 +08:00
|
|
|
! CHECK-NEXT: -W<warning> Enable the specified warning
|
2021-02-17 22:13:29 +08:00
|
|
|
! CHECK-NEXT: -Xflang <arg> Pass <arg> to the flang compiler
|
2020-10-24 19:33:19 +08:00
|
|
|
|
|
|
|
!-------------------------------------------------------------
|
|
|
|
! EXPECTED OUTPUT FOR FLANG DRIVER (flang-new)
|
|
|
|
!-------------------------------------------------------------
|
|
|
|
! ERROR-FLANG: error: unknown argument '-help-hidden'; did you mean '--help-hidden'?
|
|
|
|
|
|
|
|
!-------------------------------------------------------------
|
|
|
|
! EXPECTED OUTPUT FOR FLANG FRONTEND DRIVER (flang-new -fc1)
|
|
|
|
!-------------------------------------------------------------
|
|
|
|
! Frontend driver -help-hidden is not supported
|
|
|
|
! ERROR-FLANG-FC1: error: unknown argument: '{{.*}}'
|
|
|
|
|