[clang] [llvm] [NFC][clang][FMV][TargetInfo] Refactor API for FMV feature priority. (PR #116257)

Alexandros Lamprineas via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 26 03:20:25 PST 2024


================
@@ -4303,21 +4288,15 @@ void CodeGenModule::emitMultiVersionFunctions() {
                 continue;
 
               llvm::Function *Func = createFunction(CurFD, I);
-              StringRef Architecture;
               Feats.clear();
-              if (getTarget().getTriple().isAArch64())
-                TC->getFeatures(Feats, I);
-              else if (getTarget().getTriple().isRISCV()) {
-                StringRef Version = TC->getFeatureStr(I);
-                Feats.push_back(Version);
+              if (getTarget().getTriple().isX86()) {
+                TC->getAddedFeatures(Feats, I);
----------------
labrinea wrote:

No, `I` goes from 0 to 2 in your example. The proplem with these parsing functions in the .td file is that they are shared among all targets but they are not virtual. Each target has slightly different semantics though. If you look at line https://github.com/llvm/llvm-project/pull/116257/files#diff-e724febedab9c1a2832bf2056d208ff02ddcb2e6f90b5a653afc9b19ac78a5d7L4283 I am basically adding the same functions to the `target_clones` attribute that are used for the `target` attribute, so that the code is cleaner across targets, hiding target-specific parsing details from CodeGenModule::emitMultiVersionFunctions.

https://github.com/llvm/llvm-project/pull/116257


More information about the cfe-commits mailing list