[clang] [RISCV][FMV] Support target_version (PR #99040)
Piyou Chen via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 22 22:56:53 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;
----------------
BeMg wrote:
Added.
---
By the way, target_clones the similarly part use else for x86 target without the assert. https://github.com/llvm/llvm-project/blob/c3d3cef8d58377b02032b07b5f094a402a70435a/clang/lib/CodeGen/CodeGenModule.cpp#L4298. Should we add an assert as well?
https://github.com/llvm/llvm-project/pull/99040
More information about the cfe-commits
mailing list