[all-commits] [llvm/llvm-project] 7717c0: [X86] Remove CPU_SPECIFIC* MACROs and add getCPUDi...

Freddy Ye via All-commits all-commits at lists.llvm.org
Wed Jul 5 02:32:46 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7717c0071d7ce9f4ca7b1417f677bb0380171621
      https://github.com/llvm/llvm-project/commit/7717c0071d7ce9f4ca7b1417f677bb0380171621
  Author: Freddy Ye <freddy.ye at intel.com>
  Date:   2023-07-05 (Wed, 05 Jul 2023)

  Changed paths:
    M clang/lib/Basic/Targets/X86.cpp
    M clang/lib/Basic/Targets/X86.h
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/test/CodeGen/attr-cpuspecific-avx-abi.c
    M clang/test/CodeGen/attr-cpuspecific.c
    M llvm/include/llvm/TargetParser/X86TargetParser.def
    M llvm/include/llvm/TargetParser/X86TargetParser.h
    M llvm/lib/Target/X86/X86.td
    M llvm/lib/TargetParser/X86TargetParser.cpp
    M llvm/test/CodeGen/X86/cpus-intel.ll

  Log Message:
  -----------
  [X86] Remove CPU_SPECIFIC* MACROs and add getCPUDispatchMangling

This refactor patch means to remove CPU_SPECIFIC* MACROs in X86TargetParser.def
and move those information into ProcInfo of X86TargetParser.cpp. Since these
two files both maintain a table with redundant info such as cpuname and its
features supported. CPU_SPECIFIC* MACROs define some different information. This
patch dealt with them in these ways when moving:
1.mangling
This is now moved to Mangling in ProcInfo and directly initialized at array of
Processors. CPUs don't support cpu_dispatch/specific are assigned '\0' as
mangling.
2.CPU alias
The alias cpu will also be initialized in array of Processors, its attributes
will be same as its alias target cpu. Same feature list, same mangling.
3.TUNE_NAME
Before my change, some cpu names support cpu_dispatch/specific are not
supported in X86.td, which means optimizer/backend doesn't recognize them. So
they use a different TUNE_NAME to generate in IR. In this patch, I added these
missing cpu support at X86.td by utilizing existing Features and XXXTunings, so
that each cpu name can directly use its own name as TUNE_NAME to be supported
by optimizer/backend.
4.Feature list
The feature list of one CPU maintained in X86TargetParser.def is not same as
the one in X86TargetParser.cpp. It only maintains part of features of one CPU
(features defined by X86_FEATURE_COMPAT). While X86TargetParser.cpp maintains
a complete one. This patch abandons the feature list maintained by CPU_SPECIFIC*
MACROs because assigning a CPU with a complete one doesn't affect the
functionality of cpu_dispatch/specific.
Except these four info, since some of CPUs supported by cpu_dispatch/specific
doesn's support clang options like -march, -mtune before, this patch also kept
this behavior still by adding another member OnlyForCPUDispatchSpecific in
ProcInfo.

Reviewed By: pengfei, RKSimon

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




More information about the All-commits mailing list