[clang] [RISCV][FMV] Support target_version (PR #99040)

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 19 15:47:59 PDT 2024


================
@@ -14270,9 +14270,16 @@ void ASTContext::getFunctionFeatureMap(llvm::StringMap<bool> &FeatureMap,
       Target->initFeatureMap(FeatureMap, getDiagnostics(), TargetCPU, Features);
     }
   } else if (const auto *TV = FD->getAttr<TargetVersionAttr>()) {
-    llvm::SmallVector<StringRef, 8> Feats;
-    TV->getFeatures(Feats);
-    std::vector<std::string> Features = getFMVBackendFeaturesFor(Feats);
+    std::vector<std::string> Features;
+    if (Target->getTriple().isRISCV()) {
+      ParsedTargetAttr ParsedAttr = Target->parseTargetAttr(TV->getName());
+      Features.insert(Features.begin(), ParsedAttr.Features.begin(),
+                      ParsedAttr.Features.end());
+    } else {
+      llvm::SmallVector<StringRef, 8> Feats;
----------------
topperc wrote:

Add an assert here that the triple is AArch64

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


More information about the cfe-commits mailing list