aboutsummaryrefslogtreecommitdiff
path: root/clang/utils
diff options
context:
space:
mode:
authorSander de Smalen <sander.desmalen@arm.com>2024-01-19 16:02:24 +0000
committerGitHub <noreply@github.com>2024-01-19 16:02:24 +0000
commit40a631f452726606e1d43b5d2744aa983949af78 (patch)
treeb15643b2623beab05e079817e7cab57c21b14bf3 /clang/utils
parente89a7c41ba2d94866157056a88cfc083fa9d9cb5 (diff)
downloadllvm-40a631f452726606e1d43b5d2744aa983949af78.zip
llvm-40a631f452726606e1d43b5d2744aa983949af78.tar.gz
llvm-40a631f452726606e1d43b5d2744aa983949af78.tar.bz2
[Clang] Refactor diagnostics for SME builtins. (#78258)
The arm_sme.td file was still using `IsSharedZA` and `IsPreservesZA`, which should be changed to match the new state attributes added in #76971. This patch adds `IsInZA`, `IsOutZA` and `IsInOutZA` as the state for the Clang builtins and fixes up the code in SemaChecking and SveEmitter to match. Note that the code is written in such a way that it can be easily extended with ZT0 state (to follow in a future patch).
Diffstat (limited to 'clang/utils')
-rw-r--r--clang/utils/TableGen/SveEmitter.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/clang/utils/TableGen/SveEmitter.cpp b/clang/utils/TableGen/SveEmitter.cpp
index 99b7148..b67c8e5 100644
--- a/clang/utils/TableGen/SveEmitter.cpp
+++ b/clang/utils/TableGen/SveEmitter.cpp
@@ -1720,21 +1720,21 @@ void SVEEmitter::createBuiltinZAState(raw_ostream &OS) {
for (auto *R : RV)
createIntrinsic(R, Defs);
- std::map<bool, std::set<std::string>> DefsZAState;
-
- uint64_t IsSharedZAFlag = getEnumValueForFlag("IsSharedZA");
+ std::map<std::string, std::set<std::string>> IntrinsicsPerState;
for (auto &Def : Defs) {
- bool HasZAState = Def->isFlagSet(IsSharedZAFlag);
- DefsZAState[HasZAState].insert(Def->getMangledName());
+ if (Def->isFlagSet(getEnumValueForFlag("IsInZA")))
+ IntrinsicsPerState["ArmInZA"].insert(Def->getMangledName());
+ else if (Def->isFlagSet(getEnumValueForFlag("IsOutZA")))
+ IntrinsicsPerState["ArmOutZA"].insert(Def->getMangledName());
+ else if (Def->isFlagSet(getEnumValueForFlag("IsInOutZA")))
+ IntrinsicsPerState["ArmInOutZA"].insert(Def->getMangledName());
}
- OS << "#ifdef GET_SME_BUILTIN_HAS_ZA_STATE\n";
-
- for (auto HasZA : {true, false}) {
- auto Names = DefsZAState[HasZA];
- for (auto Name : Names)
+ OS << "#ifdef GET_SME_BUILTIN_GET_STATE\n";
+ for (auto &KV : IntrinsicsPerState) {
+ for (StringRef Name : KV.second)
OS << "case SME::BI__builtin_sme_" << Name << ":\n";
- OS << " return " << (HasZA ? "true" : "false") << ";\n";
+ OS << " return " << KV.first << ";\n";
}
OS << "#endif\n\n";
}