[clang] [Clang] Refactor diagnostics for SME builtins. (PR #78258)
Sander de Smalen via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 19 07:01:21 PST 2024
================
@@ -1720,21 +1720,29 @@ 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());
+ std::string Key;
+ auto AddToKey = [&Key](std::string S) -> void {
+ Key = Key.empty() ? S : (Key + " | " + S);
+ };
+
+ if (Def->isFlagSet(getEnumValueForFlag("IsInZA")))
+ AddToKey("ArmInZA");
+ else if (Def->isFlagSet(getEnumValueForFlag("IsOutZA")))
+ AddToKey("ArmOutZA");
+ else if (Def->isFlagSet(getEnumValueForFlag("IsInOutZA")))
+ AddToKey("ArmInOutZA");
+
+ if (!Key.empty())
+ IntrinsicsPerState[Key].insert(Def->getMangledName());
----------------
sdesmalen-arm wrote:
I wrote this with the follow-up patch in mind, but I agree it doesn't make much sense without the follow-up. I'll simplify it.
FWIW, the idea was to support `return ArmInZA | ArmOutZT0`. `ArmInZA/ArmOutZA/ArmInOutZA` are all mutually exclusive, so we can't return `ArmInZA | ArmOutZA`.
https://github.com/llvm/llvm-project/pull/78258
More information about the cfe-commits
mailing list