[flang-commits] [clang] [flang] [Flang][Driver] Add -print-resource-dir command line flag to emit Flang's resource directory (PR #90886)

Michael Klemm via flang-commits flang-commits at lists.llvm.org
Mon May 13 06:56:52 PDT 2024


https://github.com/mjklemm updated https://github.com/llvm/llvm-project/pull/90886

>From 1a994159025f127f0f7d11da80b74035788d52c9 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Thu, 2 May 2024 14:50:45 +0200
Subject: [PATCH 1/8] Enable -print-resource-dir also for Flang

---
 clang/include/clang/Driver/Options.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 864da4e1157f7..a3b81fa338bdc 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5474,7 +5474,7 @@ def print_prog_name_EQ : Joined<["-", "--"], "print-prog-name=">,
   Visibility<[ClangOption, CLOption]>;
 def print_resource_dir : Flag<["-", "--"], "print-resource-dir">,
   HelpText<"Print the resource directory pathname">,
-  Visibility<[ClangOption, CLOption]>;
+  Visibility<[ClangOption, CLOption, FlangOption]>;
 def print_search_dirs : Flag<["-", "--"], "print-search-dirs">,
   HelpText<"Print the paths used for finding libraries and programs">,
   Visibility<[ClangOption, CLOption]>;

>From beee04f6f2d411694f5ae1ee6130a81a632164df Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Thu, 2 May 2024 16:19:38 +0200
Subject: [PATCH 2/8] Add setResourceDir function to set resource directory for
 Flang

This should be an NFC change for anythign, but Flang.
---
 clang/include/clang/Driver/Driver.h |  3 +++
 clang/lib/Driver/Driver.cpp         | 23 ++++++++++++++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/clang/include/clang/Driver/Driver.h b/clang/include/clang/Driver/Driver.h
index 2ffc52bcb7ad3..c36595e62e2da 100644
--- a/clang/include/clang/Driver/Driver.h
+++ b/clang/include/clang/Driver/Driver.h
@@ -752,6 +752,9 @@ class Driver {
   /// option.
   void setDriverMode(StringRef DriverModeValue);
 
+  /// Set the resource directory, depending on which driver is being used.
+  void setResourceDirectory();
+
   /// Parse the \p Args list for LTO options and record the type of LTO
   /// compilation based on which -f(no-)?lto(=.*)? option occurs last.
   void setLTOMode(const llvm::opt::ArgList &Args);
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 114320f5d3146..d75d2e88fc102 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -229,9 +229,6 @@ Driver::Driver(StringRef ClangExecutable, StringRef TargetTriple,
     UserConfigDir = static_cast<std::string>(P);
   }
 #endif
-
-  // Compute the path to the resource directory.
-  ResourceDir = GetResourcesPath(ClangExecutable, CLANG_RESOURCE_DIR);
 }
 
 void Driver::setDriverMode(StringRef Value) {
@@ -250,6 +247,25 @@ void Driver::setDriverMode(StringRef Value) {
     Diag(diag::err_drv_unsupported_option_argument) << OptName << Value;
 }
 
+void Driver::setResourceDirectory() {
+  // Compute the path to the resource directory, depending on the driver mode.
+  switch (Mode) {
+  case GCCMode:
+  case GXXMode:
+  case CPPMode:
+  case CLMode:
+  case DXCMode:
+    ResourceDir = GetResourcesPath(ClangExecutable, CLANG_RESOURCE_DIR);
+    break;
+  case FlangMode:
+    // TODO: Is there a better way to add the "../include/flang/" component?
+    SmallString<64> relPath{};
+    llvm::sys::path::append(relPath, "..", "include", "flang");
+    ResourceDir = GetResourcesPath(ClangExecutable, relPath);
+    break;
+  }
+}
+
 InputArgList Driver::ParseArgStrings(ArrayRef<const char *> ArgStrings,
                                      bool UseDriverMode, bool &ContainsError) {
   llvm::PrettyStackTraceString CrashInfo("Command line argument parsing");
@@ -1202,6 +1218,7 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
   if (!DriverMode.empty())
     setDriverMode(DriverMode);
 
+  setResourceDirectory();
   // FIXME: What are we going to do with -V and -b?
 
   // Arguments specified in command line.

>From 5ca34138043ab621582085e7034349c7e726a970 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Thu, 2 May 2024 20:31:04 +0200
Subject: [PATCH 3/8] Update/add tests fir -print-resource-dir

---
 flang/test/Driver/driver-help-hidden.f90 | 1 +
 flang/test/Driver/print-resource-dir.F90 | 3 +++
 2 files changed, 4 insertions(+)
 create mode 100644 flang/test/Driver/print-resource-dir.F90

diff --git a/flang/test/Driver/driver-help-hidden.f90 b/flang/test/Driver/driver-help-hidden.f90
index 706b2cb6c2452..73b34bd321c5f 100644
--- a/flang/test/Driver/driver-help-hidden.f90
+++ b/flang/test/Driver/driver-help-hidden.f90
@@ -143,6 +143,7 @@
 ! CHECK-NEXT: -o <file>               Write output to <file>
 ! CHECK-NEXT: -pedantic               Warn on language extensions
 ! CHECK-NEXT: -print-effective-triple Print the effective target triple
+! CHECK-NEXT: -print-resource-dir     Print the resource directory pathname
 ! CHECK-NEXT: -print-target-triple    Print the normalized target triple
 ! CHECK-NEXT: -pthread                Support POSIX threads in generated code
 ! CHECK-NEXT: -P                      Disable linemarker output in -E mode
diff --git a/flang/test/Driver/print-resource-dir.F90 b/flang/test/Driver/print-resource-dir.F90
new file mode 100644
index 0000000000000..5c934312e1f68
--- /dev/null
+++ b/flang/test/Driver/print-resource-dir.F90
@@ -0,0 +1,3 @@
+! RUN: %flang -print-resource-dir -resource-dir=%S/Inputs/resource_dir \
+! RUN:  | FileCheck -check-prefix=PRINT-RESOURCE-DIR -DFILE=%S/Inputs/resource_dir %s
+! PRINT-RESOURCE-DIR: [[FILE]]

>From 99f61034d5c5e66919670723ef881b46ed006321 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Fri, 3 May 2024 09:35:25 +0200
Subject: [PATCH 4/8] Simplify test by using DEFINE to avoid repitition

---
 flang/test/Driver/print-resource-dir.F90 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/flang/test/Driver/print-resource-dir.F90 b/flang/test/Driver/print-resource-dir.F90
index 5c934312e1f68..8fd35f1800df2 100644
--- a/flang/test/Driver/print-resource-dir.F90
+++ b/flang/test/Driver/print-resource-dir.F90
@@ -1,3 +1,4 @@
-! RUN: %flang -print-resource-dir -resource-dir=%S/Inputs/resource_dir \
-! RUN:  | FileCheck -check-prefix=PRINT-RESOURCE-DIR -DFILE=%S/Inputs/resource_dir %s
+! DEFINE: %{resource_dir} = %S/Inputs/resource_dir
+! RUN: %flang -print-resource-dir -resource-dir=%{resource_dir}.. \
+! RUN:  | FileCheck -check-prefix=PRINT-RESOURCE-DIR -DFILE=%{resource_dir} %s
 ! PRINT-RESOURCE-DIR: [[FILE]]

>From c0e0cdb0960fc76545f88ca74c4d2d68dc5a4928 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Fri, 3 May 2024 09:35:47 +0200
Subject: [PATCH 5/8] Be more verbose about the variable name for the relative
 path

---
 clang/lib/Driver/Driver.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index d75d2e88fc102..54c662d30f028 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -259,9 +259,11 @@ void Driver::setResourceDirectory() {
     break;
   case FlangMode:
     // TODO: Is there a better way to add the "../include/flang/" component?
-    SmallString<64> relPath{};
-    llvm::sys::path::append(relPath, "..", "include", "flang");
-    ResourceDir = GetResourcesPath(ClangExecutable, relPath);
+    SmallString<64> customResourcePathReleativeToDriver{};
+    llvm::sys::path::append(customResourcePathReleativeToDriver, "..",
+                            "include", "flang");
+    ResourceDir =
+        GetResourcesPath(ClangExecutable, customResourcePathReleativeToDriver);
     break;
   }
 }

>From 462b3931fac6f7a54ad822573bf9f90fd59e1706 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Fri, 3 May 2024 02:52:43 -0500
Subject: [PATCH 6/8] Move to folder containing lib and include, also
 simplifies path construction.

---
 clang/lib/Driver/Driver.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 54c662d30f028..6433d96b3517a 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -258,12 +258,9 @@ void Driver::setResourceDirectory() {
     ResourceDir = GetResourcesPath(ClangExecutable, CLANG_RESOURCE_DIR);
     break;
   case FlangMode:
-    // TODO: Is there a better way to add the "../include/flang/" component?
-    SmallString<64> customResourcePathReleativeToDriver{};
-    llvm::sys::path::append(customResourcePathReleativeToDriver, "..",
-                            "include", "flang");
+    SmallString<64> customResourcePathRelativeToDriver{".."};
     ResourceDir =
-        GetResourcesPath(ClangExecutable, customResourcePathReleativeToDriver);
+        GetResourcesPath(ClangExecutable, customResourcePathRelativeToDriver);
     break;
   }
 }

>From cf90392ae41849c3166fb8cfaf02064a9defedab Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Fri, 3 May 2024 12:34:49 +0200
Subject: [PATCH 7/8] Improve help message

---
 clang/include/clang/Driver/Options.td | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index a3b81fa338bdc..2bd5fc60c2eec 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5474,6 +5474,9 @@ def print_prog_name_EQ : Joined<["-", "--"], "print-prog-name=">,
   Visibility<[ClangOption, CLOption]>;
 def print_resource_dir : Flag<["-", "--"], "print-resource-dir">,
   HelpText<"Print the resource directory pathname">,
+  HelpTextForVariants<[FlangOption],
+                      "Print the resource directory pathname that contains lib and "
+                      "include directories with the runtime libraries and MODULE files.">,
   Visibility<[ClangOption, CLOption, FlangOption]>;
 def print_search_dirs : Flag<["-", "--"], "print-search-dirs">,
   HelpText<"Print the paths used for finding libraries and programs">,

>From fde9e0750b9f01c5bbfcc2baf4460fcfd3f04b22 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Mon, 13 May 2024 15:56:24 +0200
Subject: [PATCH 8/8] Resolve conflict with delete test file

---
 flang/test/Driver/driver-help-hidden.f90 | 173 -----------------------
 1 file changed, 173 deletions(-)
 delete mode 100644 flang/test/Driver/driver-help-hidden.f90

diff --git a/flang/test/Driver/driver-help-hidden.f90 b/flang/test/Driver/driver-help-hidden.f90
deleted file mode 100644
index 73b34bd321c5f..0000000000000
--- a/flang/test/Driver/driver-help-hidden.f90
+++ /dev/null
@@ -1,173 +0,0 @@
-
-!--------------------------
-! FLANG DRIVER (flang-new)
-!--------------------------
-! 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)
-!----------------------------------------
-! 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-EMPTY:
-! CHECK-NEXT: DRIVER OPTIONS:
-! CHECK-NEXT:  --driver-mode=<value> Set the driver mode to either 'gcc', 'g++', 'cpp', 'cl' or 'flang'
-! CHECK-EMPTY:
-! CHECK-NEXT:OPTIONS:
-! CHECK-NEXT: -###                    Print (but do not run) the commands to run for this compilation
-! CHECK-NEXT: -ccc-print-phases       Dump list of actions to perform
-! CHECK-NEXT: -cpp                    Enable predefined and command line preprocessor macros
-! CHECK-NEXT: -c                      Only run preprocess, compile, and assemble steps
-! CHECK-NEXT: -dM                     Print macro definitions in -E mode instead of normal output
-! CHECK-NEXT: -dumpmachine            Display the compiler's target processor
-! CHECK-NEXT: -dumpversion            Display the version of the compiler
-! CHECK-NEXT: -D <macro>=<value>      Define <macro> to <value> (or 1 if <value> omitted)
-! CHECK-NEXT: -emit-llvm              Use the LLVM representation for assembler and object files
-! CHECK-NEXT: -E                      Only run the preprocessor
-! CHECK-NEXT: -falternative-parameter-statement
-! CHECK-NEXT:                         Enable the old style PARAMETER statement
-! CHECK-NEXT: -fapprox-func           Allow certain math function calls to be replaced with an approximately equivalent calculation
-! CHECK-NEXT: -fbackslash             Specify that backslash in string introduces an escape character
-! CHECK-NEXT: -fcolor-diagnostics     Enable colors in diagnostics
-! CHECK-NEXT: -fconvert=<value>       Set endian conversion of data for unformatted files
-! 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 and logical kind to an 8 byte wide type
-! CHECK-NEXT: -fdefault-real-8        Set the default real kind to an 8 byte wide type
-! CHECK-NEXT: -ffast-math             Allow aggressive, lossy floating-point optimizations
-! 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: -ffp-contract=<value>   Form fused FP ops (e.g. FMAs)
-! CHECK-NEXT: -ffree-form             Process source files in free form
-! CHECK-NEXT: -fhonor-infinities      Specify that floating-point optimizations are not allowed that assume arguments and results are not +-inf.
-! CHECK-NEXT: -fhonor-nans            Specify that floating-point optimizations are not allowed that assume arguments and results are not NANs.
-! 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
-! CHECK-NEXT: -fintegrated-as         Enable the integrated assembler
-! CHECK-NEXT: -fintrinsic-modules-path <dir>
-! CHECK-NEXT:                         Specify where to find the compiled intrinsic modules
-! CHECK-NEXT: -flang-deprecated-no-hlfir
-! CHECK-NEXT:                         Do not use HLFIR lowering (deprecated)
-! 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
-! CHECK-NEXT: -flogical-abbreviations Enable logical abbreviations
-! CHECK-NEXT: -flto=auto              Enable LTO in 'full' mode
-! CHECK-NEXT: -flto=jobserver         Enable LTO in 'full' mode
-! CHECK-NEXT: -flto=<value>           Set LTO mode
-! CHECK-NEXT: -flto                   Enable LTO in 'full' mode
-! CHECK-NEXT: -fms-runtime-lib=<value>
-! CHECK-NEXT:                         Select Windows run-time library
-! CHECK-NEXT: -fno-automatic          Implies the SAVE attribute for non-automatic local objects in subprograms unless RECURSIVE
-! CHECK-NEXT: -fno-color-diagnostics  Disable colors in diagnostics
-! CHECK-NEXT: -fno-integrated-as      Disable the integrated assembler
-! CHECK-NEXT: -fno-lto                Disable LTO mode (default)
-! CHECK-NEXT: -fno-ppc-native-vector-element-order
-! CHECK-NEXT:                         Specifies PowerPC non-native vector element order
-! CHECK-NEXT: -fno-rtlib-add-rpath Do not add -rpath with architecture-specific resource directory to the linker flags. When --hip-link is specified, do not add -rpath with HIP runtime library directory to the linker flags
-! CHECK-NEXT: -fno-signed-zeros       Allow optimizations that ignore the sign of floating point zeros
-! CHECK-NEXT: -fno-stack-arrays       Allocate array temporaries on the heap (default)
-! CHECK-NEXT: -fno-version-loops-for-stride
-! CHECK-NEXT:                         Do not create unit-strided loops (default)
-! CHECK-NEXT: -fomit-frame-pointer    Omit the frame pointer from functions that don't need it. Some stack unwinding cases, such as profilers and sanitizers, may prefer specifying -fno-omit-frame-pointer. On many targets, -O1 and higher omit the frame pointer by default. -m[no-]omit-leaf-frame-pointer takes precedence for leaf functions
-! CHECK-NEXT: -fopenacc               Enable OpenACC
-! CHECK-NEXT: -fopenmp-assume-no-nested-parallelism
-! CHECK-NEXT:                         Assert no nested parallel regions in the GPU
-! CHECK-NEXT: -fopenmp-assume-no-thread-state
-! CHECK-NEXT:                         Assert no thread in a parallel region modifies an ICV
-! CHECK-NEXT: -fopenmp-target-debug   Enable debugging in the OpenMP offloading device RTL
-! CHECK-NEXT: -fopenmp-targets=<value>
-! CHECK-NEXT:                         Specify comma-separated list of triples OpenMP offloading targets to be supported
-! CHECK-NEXT: -fopenmp-version=<value>
-! CHECK-NEXT:                         Set OpenMP version (e.g. 45 for OpenMP 4.5, 51 for OpenMP 5.1). Default value is 11 for Flang
-! CHECK-NEXT: -fopenmp                Parse OpenMP pragmas and generate parallel code.
-! CHECK-NEXT: -foptimization-record-file=<file>
-! CHECK-NEXT:                         Specify the output name of the file containing the optimization remarks. Implies -fsave-optimization-record. On Darwin platforms, this cannot be used with multiple -arch <arch> options.
-! CHECK-NEXT: -foptimization-record-passes=<regex>
-! CHECK-NEXT:                         Only include passes which match a specified regular expression in the generated optimization record (by default, include all passes)
-! CHECK-NEXT: -fpass-plugin=<dsopath> Load pass plugin from a dynamic shared object file (only with new pass manager).
-! CHECK-NEXT: -fppc-native-vector-element-order
-! CHECK-NEXT:                         Specifies PowerPC native vector element order (default)
-! CHECK-NEXT: -freciprocal-math       Allow division operations to be reassociated
-! CHECK-NEXT: -fropi                  Generate read-only position independent code (ARM only)
-! CHECK-NEXT: -frtlib-add-rpath Add -rpath with architecture-specific resource directory to the linker flags. When --hip-link is specified, also add -rpath with HIP runtime library directory to the linker flags
-! CHECK-NEXT: -frwpi                  Generate read-write position independent code (ARM only)
-! CHECK-NEXT: -fsave-optimization-record=<format>
-! CHECK-NEXT:                         Generate an optimization record file in a specific format
-! CHECK-NEXT: -fsave-optimization-record
-! CHECK-NEXT:                         Generate a YAML optimization record file
-! CHECK-NEXT: -fstack-arrays          Attempt to allocate array temporaries on the stack, no matter their size
-! CHECK-NEXT: -fsyntax-only           Run the preprocessor, parser and semantic analysis stages
-! CHECK-NEXT: -funderscoring          Appends one trailing underscore to external names
-! CHECK-NEXT: -fveclib=<value>        Use the given vector functions library
-! CHECK-NEXT: -fversion-loops-for-stride
-! CHECK-NEXT:                         Create unit-strided versions of loops
-! CHECK-NEXT: -fxor-operator          Enable .XOR. as a synonym of .NEQV.
-! CHECK-NEXT: --gcc-install-dir=<value>
-! CHECK-NEXT:                         Use GCC installation in the specified directory. The directory ends with path components like 'lib{,32,64}/gcc{,-cross}/$triple/$version'. Note: executables (e.g. ld) used by the compiler are not overridden by the selected GCC installation
-! CHECK-NEXT: --gcc-toolchain=<value> Specify a directory where Flang can find 'lib{,32,64}/gcc{,-cross}/$triple/$version'. Flang will use the GCC installation with the largest version
-! CHECK-NEXT: -gline-directives-only  Emit debug line info directives only
-! CHECK-NEXT: -gline-tables-only      Emit debug line number tables only
-! CHECK-NEXT: -gpulibc                Link the LLVM C Library for GPUs
-! CHECK-NEXT: -g                      Generate source-level debug information
-! CHECK-NEXT: --help-hidden           Display help for hidden options
-! CHECK-NEXT: -help                   Display available options
-! CHECK-NEXT: -isysroot <dir>         Set the system root directory (usually /)
-! CHECK-NEXT: -I <dir>                Add directory to the end of the list of include search paths
-! CHECK-NEXT: -L <dir>                Add directory to library search path
-! CHECK-NEXT: -march=<value>          For a list of available architectures for the target use '-mcpu=help'
-! CHECK-NEXT: -mcode-object-version=<value>
-! CHECK-NEXT:                         Specify code object ABI version. Defaults to 5. (AMDGPU only)
-! CHECK-NEXT: -mcpu=<value>           For a list of available CPUs for the target use '-mcpu=help'
-! CHECK-NEXT: -mllvm=<arg>            Alias for -mllvm
-! CHECK-NEXT: -mllvm <value>          Additional arguments to forward to LLVM's option processing
-! CHECK-NEXT: -mmlir <value>          Additional arguments to forward to MLIR's option processing
-! CHECK-NEXT: -mno-outline-atomics    Don't generate local calls to out-of-line atomic operations
-! CHECK-NEXT: -module-dir <dir>       Put MODULE files in <dir>
-! CHECK-NEXT: -moutline-atomics       Generate local calls to out-of-line atomic operations
-! CHECK-NEXT: -mrvv-vector-bits=<value>
-! CHECK-NEXT:                         Specify the size in bits of an RVV vector register
-! CHECK-NEXT: -msve-vector-bits=<value>
-! CHECK-NEXT:                          Specify the size in bits of an SVE vector register. Defaults to the vector length agnostic value of "scalable". (AArch64 only)
-! CHECK-NEXT: --no-offload-arch=<value>
-! CHECK-NEXT:                         Remove CUDA/HIP offloading device architecture (e.g. sm_35, gfx906) from the list of devices to compile for. 'all' resets the list to its default value.
-! CHECK-NEXT: -nocpp                  Disable predefined and command line preprocessor macros
-! CHECK-NEXT: -nogpulib               Do not link device library for CUDA/HIP device compilation
-! CHECK-NEXT: --offload-arch=<value>  Specify an offloading device architecture for CUDA, HIP, or OpenMP. (e.g. sm_35). If 'native' is used the compiler will detect locally installed architectures. For HIP offloading, the device architecture can be followed by target ID features delimited by a colon (e.g. gfx908:xnack+:sramecc-). May be specified more than once.
-! CHECK-NEXT: --offload-device-only   Only compile for the offloading device.
-! CHECK-NEXT: --offload-host-device   Compile for both the offloading host and device (default).
-! CHECK-NEXT: --offload-host-only     Only compile for the offloading host.
-! CHECK-NEXT: -o <file>               Write output to <file>
-! CHECK-NEXT: -pedantic               Warn on language extensions
-! CHECK-NEXT: -print-effective-triple Print the effective target triple
-! CHECK-NEXT: -print-resource-dir     Print the resource directory pathname
-! CHECK-NEXT: -print-target-triple    Print the normalized target triple
-! CHECK-NEXT: -pthread                Support POSIX threads in generated code
-! CHECK-NEXT: -P                      Disable linemarker output in -E mode
-! CHECK-NEXT: -resource-dir <value>   The directory which holds the compiler resource files
-! CHECK-NEXT: --rocm-path=<value> ROCm installation path, used for finding and automatically linking required bitcode libraries.
-! CHECK-NEXT: -Rpass-analysis=<value> Report transformation analysis from optimization passes whose name matches the given POSIX regular expression
-! CHECK-NEXT: -Rpass-missed=<value>   Report missed transformations by optimization passes whose name matches the given POSIX regular expression
-! CHECK-NEXT: -Rpass=<value>          Report transformations performed by optimization passes whose name matches the given POSIX regular expression
-! CHECK-NEXT: -R<remark>              Enable the specified remark
-! CHECK-NEXT: -save-temps=<value>     Save intermediate compilation results.
-! CHECK-NEXT: -save-temps             Alias for --save-temps=cwd
-! CHECK-NEXT: -std=<value>            Language standard to compile for
-! CHECK-NEXT: -S                      Only run preprocess and compilation steps
-! CHECK-NEXT: --target=<value>        Generate code for the given target
-! CHECK-NEXT: -U <macro>              Undefine macro <macro>
-! CHECK-NEXT: --version               Print version information
-! CHECK-NEXT: -v                      Show commands to run and use verbose output
-! CHECK-NEXT: -Wl,<arg>               Pass the comma separated arguments in <arg> to the linker
-! CHECK-NEXT: -W<warning>             Enable the specified warning
-! CHECK-NEXT: -Xflang <arg>           Pass <arg> to the flang compiler
-! CHECK-NEXT: -x <language>           Treat subsequent input files as having type <language>
-
-
-! ERROR-FLANG: error: unknown argument '-help-hidden'; did you mean '--help-hidden'?
-
-! Frontend driver -help-hidden is not supported
-! ERROR-FLANG-FC1: error: unknown argument: '{{.*}}'



More information about the flang-commits mailing list