[PATCH] D151696: [x86] Remove CPU_SPECIFIC* MACROs and add getManglingForCPU

Freddy, Ye via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 14 22:46:30 PDT 2023


FreddyYe added a comment.

This patch means to remove `CPU_SPECIFIC*` MACROs in X86TargetParser.def and move that part of functionality into X86TargetParser.cpp.
Since these two files **both** maintain a table with `cpuname`, `features of this cpu supported`, ... This move can reduce the codes.

CPU_SPECIFIC* has some different and specific information maintained. 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. This patch also supports some of new intel cpus for cpu_dispatch/specific feature.
2. alias relationship 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 utilize 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 in X86TargetParser.def because assigning a CPU with a complete feature list in X86TargetParser.cpp doesn't affect the functionality of cpu_dispatch/specific. See the implement of llvm::X86::getCpuSupportsMask, it already masked out the features not defined by X86_FEATURE_COMPAT.

Beyond these four information, 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 `OnlyForCPUSpecificDispath` in `ProcInfo`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151696/new/

https://reviews.llvm.org/D151696



More information about the cfe-commits mailing list