[all-commits] [llvm/llvm-project] 2e9439: [flang][driver] Add support for `--target`/`--triple`

Andrzej WarzyƄski via All-commits all-commits at lists.llvm.org
Fri Feb 25 01:45:55 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2e9439e4891c3d427c0fed477b54f3da2ff8ec28
      https://github.com/llvm/llvm-project/commit/2e9439e4891c3d427c0fed477b54f3da2ff8ec28
  Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
  Date:   2022-02-25 (Fri, 25 Feb 2022)

  Changed paths:
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/ToolChains/Flang.cpp
    M flang/include/flang/Frontend/CompilerInvocation.h
    A flang/include/flang/Frontend/TargetOptions.h
    M flang/lib/Frontend/CompilerInvocation.cpp
    M flang/lib/Frontend/FrontendActions.cpp
    M flang/test/Driver/driver-help-hidden.f90
    M flang/test/Driver/driver-help.f90
    A flang/test/Driver/print-effective-triple.f90
    A flang/test/Driver/print-target-triple.f90
    A flang/test/Driver/target.f90

  Log Message:
  -----------
  [flang][driver] Add support for `--target`/`--triple`

This patch adds support for:
  * `--target` in the compiler driver (`flang-new`)
  * `--triple` in the frontend driver (`flang-new -fc1`)
The semantics of these flags are inherited from `clangDriver`, i.e.
consistent with `clang --target` and `clang -cc1 --triple`,
respectively.

A new structure is defined, `TargetOptions`, that will hold various
Frontend options related to the target. Currently, this is mostly a
placeholder that contains the target triple. In the future, it will be
used for storing e.g. the CPU to tune for or the target features to
enable.

Additionally, the following target/triple related options are enabled
[*]: `-print-effective-triple`, `-print-target-triple`. Definitions in
Options.td are updated accordingly and, to facilated testing,
`-emit-llvm` is added to the list of options available in `flang-new`
(previously it was only enabled in `flang-new -fc1`).

[*] These options were actually available before (like all other options
defined in `clangDriver`), but not included in `flang-new --help`.
Before this change, `flang-new` would just use `native` for defining the
target, so these options were of little value.

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




More information about the All-commits mailing list