[clang] [RISCV][FMV] Support target_version (PR #99040)
Piyou Chen via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 23 01:14:14 PDT 2024
================
@@ -3056,6 +3056,45 @@ bool Sema::checkTargetVersionAttr(SourceLocation LiteralLoc, Decl *D,
enum SecondParam { None };
enum ThirdParam { Target, TargetClones, TargetVersion };
llvm::SmallVector<StringRef, 8> Features;
+ if (Context.getTargetInfo().getTriple().isRISCV()) {
+
+ llvm::SmallVector<StringRef, 8> AttrStrs;
+ AttrStr.split(AttrStrs, ';');
+
+ bool IsPriority = false;
+ bool IsDefault = false;
+ for (auto &AttrStr : AttrStrs) {
+ // Only support arch=+ext,... syntax.
----------------
BeMg wrote:
The line `arch=rv64gc` will trigger a warning because it currently doesn't support the full architecture.
`unsupported 'arch=rv64gcv' in the 'target_version' attribute string; 'target_version' attribute ignored`
https://github.com/llvm/llvm-project/blob/b89211cdd27474469b4e6ca1206c12892a85974b/clang/lib/Sema/SemaDeclAttr.cpp#L3089
`target_version("arch=+c;default")` has already new `HasArch` guard, and it also emit the warning.
`unsupported 'arch=+c;default' in the 'target_version' attribute string; 'target_version' attribute ignored`
https://github.com/llvm/llvm-project/pull/99040
More information about the cfe-commits
mailing list