[all-commits] [llvm/llvm-project] 13e977: [AArch64][Driver] Better handling of target featur...

ostannard via All-commits all-commits at lists.llvm.org
Wed Jan 17 08:20:46 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 13e977d1738261487d8157918f14497517d75821
      https://github.com/llvm/llvm-project/commit/13e977d1738261487d8157918f14497517d75821
  Author: ostannard <oliver.stannard at arm.com>
  Date:   2024-01-17 (Wed, 17 Jan 2024)

  Changed paths:
    M clang/lib/Basic/Targets/AArch64.cpp
    M clang/lib/Driver/ToolChains/Arch/AArch64.cpp
    M clang/test/Driver/aarch64-bf16.c
    M clang/test/Driver/aarch64-cortex-a510.c
    M clang/test/Driver/aarch64-cortex-a710.c
    M clang/test/Driver/aarch64-cortex-x2.c
    M clang/test/Driver/aarch64-d128.c
    M clang/test/Driver/aarch64-fp16.c
    M clang/test/Driver/aarch64-implied-sme-features.c
    M clang/test/Driver/aarch64-implied-sve-features.c
    M clang/test/Driver/aarch64-ite.c
    M clang/test/Driver/aarch64-lrcpc3.c
    M clang/test/Driver/aarch64-ls64.c
    M clang/test/Driver/aarch64-lse128.c
    M clang/test/Driver/aarch64-march.c
    M clang/test/Driver/aarch64-mgeneral_regs_only.c
    M clang/test/Driver/aarch64-mte.c
    M clang/test/Driver/aarch64-perfmon.c
    M clang/test/Driver/aarch64-predres.c
    M clang/test/Driver/aarch64-rand.c
    M clang/test/Driver/aarch64-ras.c
    M clang/test/Driver/aarch64-rdm.c
    M clang/test/Driver/aarch64-ssbs.c
    M clang/test/Driver/aarch64-sve2.c
    M clang/test/Driver/aarch64-the.c
    M clang/test/Driver/aarch64-v81a.c
    M clang/test/Driver/aarch64-v82a.c
    M clang/test/Driver/aarch64-v83a.c
    M clang/test/Driver/aarch64-v84a.c
    M clang/test/Driver/aarch64-v85a.c
    M clang/test/Driver/aarch64-v86a.c
    M clang/test/Driver/aarch64-v87a.c
    M clang/test/Driver/aarch64-v88a.c
    M clang/test/Driver/aarch64-v89a.c
    M clang/test/Driver/aarch64-v91a.c
    M clang/test/Driver/aarch64-v92a.c
    M clang/test/Driver/aarch64-v93a.c
    M clang/test/Driver/aarch64-v94a.c
    M clang/test/Driver/aarch64-v95a.c
    M clang/test/Driver/arm-sb.c
    M clang/test/Preprocessor/aarch64-target-features.c
    M flang/test/Driver/target-cpu-features.f90
    M llvm/include/llvm/TargetParser/AArch64TargetParser.h
    M llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
    M llvm/lib/TargetParser/AArch64TargetParser.cpp
    M llvm/unittests/TargetParser/TargetParserTest.cpp

  Log Message:
  -----------
  [AArch64][Driver] Better handling of target feature dependencies (#78270)

Currently there are several bits of code in the AArch64 driver which
attempt to enforce dependencies between optional features in the -march=
and -mcpu= options. However, these are based on the list of feature
names being enabled/disabled, so they have a lot of logic to consider
the order in which features were turned on and off, which doesn't scale
well as dependency chains get longer.

This patch moves the code handling these dependencies to TargetParser,
and changes them to use a Bitset of enabled features. This makes it easy
to check which features are enabled, and is converted back to a list of
LLVM feature names once all of the command-line options are parsed.

The motivating example for this was the -mcpu=cortex-r82+nofp option.
Previously, the code handling the dependency between the fp16 and
fp16fml extensions did not consider the nofp modifier, so it added
+fullfp16 to the feature list. This should have been disabled by the
+nofp modifier, and also the backend did follow the dependency between
fullfp16 and fp, resulting in fp being turned back on in the backend.

Most of the dependencies added to AArch64TargetParser.h weren't known
about by clang before, I built that list by checking what the backend
thinks the dependencies between SubtargetFeatures are.




More information about the All-commits mailing list