[llvm] [AArch64][SME2] Add ZT0 attributes to SMEAttrs (PR #77607)
Matthew Devereau via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 10 06:19:05 PST 2024
================
@@ -28,6 +31,11 @@ void SMEAttrs::set(unsigned M, bool Enable) {
"ZA_New and ZA_NoLazySave are mutually exclusive");
assert(!(hasSharedZAInterface() && (Bitmask & ZA_NoLazySave)) &&
"ZA_Shared and ZA_NoLazySave are mutually exclusive");
+
+ // ZT0 Attrs
+ assert((!sharesZT0() || (hasNewZT0Body() ^ isZT0In() ^ isZT0InOut() ^
+ isZT0Out() ^ preservesZT0())) &&
+ "ZT0_New,In,Out,InOut,Preserved are mutually exclusive");
----------------
MDevereau wrote:
Is it possible to tighten this up and make it more specific? First, I think it should have full names like `ZT0_New, ZT0_In, ZT0_Out` and have spaces after the commas to make it a bit easier to read. Second, sorry if I'm sending you on a wild goose chase, is it possible to do something along the lines of
```c++
SmallVector<StringRef> Attrs;
if (hasNewZT0Body())
Attrs.push_back("ZT0_New");
if (isZT0In())
Attrs.push_back("ZT0_In");
// ...
// test other mutually exclusive attributes
if (Attrs.size() > 1){
// join Attrs into a string and bail as an llvm_unreachable
}
```
?
That way we print a better diagnostic since we know exactly what mutually exclusive attributes are causing the problem
https://github.com/llvm/llvm-project/pull/77607
More information about the llvm-commits
mailing list