[PATCH] D137995: [Flang][Driver] Handle target CPU and features

Usman Nadeem via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 14 17:07:29 PST 2022


mnadeem created this revision.
mnadeem added reviewers: vzakhari, awarzynski, kiranchandramohan.
mnadeem added a project: Flang.
Herald added subscribers: ctetreau, jdoerfert, s.egerton, simoncook, fedor.sergeev, kristof.beyls, dschuff.
Herald added a reviewer: sscalpone.
Herald added a project: All.
mnadeem requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay, aheejin.
Herald added a project: clang.

This patch:

- Adds `target-feature` and `target-cpu` to FC1Options.
- Moves `getTargetFeatures()` from Clang.cpp to CommonArgs.cpp.
- Processes target cpu and features in the flang driver. Right now features are only added for AArch64 because I only did basic testing on AArch64 but it should generally work for others as well.
- Adds appropriate structures in TargetOptions and passes them to the target machine.

What's missing:

- Adding the CPU info and the features as attributes in the LLVM IR module.
- Processing target specific flags, e.g. SVE vector bits for AArch64, ABI etc.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137995

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/Flang.cpp
  clang/lib/Driver/ToolChains/Flang.h
  flang/include/flang/Frontend/TargetOptions.h
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/lib/Frontend/FrontendActions.cpp
  flang/test/Driver/driver-help.f90
  flang/test/Driver/target-cpu-features.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137995.475307.patch
Type: text/x-patch
Size: 17130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221115/7401bcc2/attachment-0001.bin>


More information about the cfe-commits mailing list