[PATCH] D120246: [flang][driver] Add support for `--target`/`--triple`

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 21 05:19:13 PST 2022


awarzynski created this revision.
awarzynski added reviewers: rovka, clementval, schweitz, Leporacanthicus.
Herald added subscribers: dang, usaxena95, kadircet.
Herald added a reviewer: sscalpone.
Herald added a project: Flang.
awarzynski requested review of this revision.
Herald added subscribers: cfe-commits, jdoerfert, ilya-biryukov.
Herald added a project: clang.

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-ffective-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`).

[X] 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120246

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Flang.cpp
  flang/include/flang/Frontend/CompilerInvocation.h
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/lib/Frontend/FrontendActions.cpp
  flang/test/Driver/driver-help-hidden.f90
  flang/test/Driver/driver-help.f90
  flang/test/Driver/print-target-triple.f90
  flang/test/Driver/target.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120246.410281.patch
Type: text/x-patch
Size: 13459 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220221/6e053e2e/attachment-0001.bin>


More information about the cfe-commits mailing list