================
@@ -8041,6 +8046,51 @@ static bool handleArmStateAttribute(Sema &S,
return false;
}
+static bool handleRISCVStateAttribute(Sema &S,
+ FunctionProtoType::ExtProtoInfo &EPI,
+ ParsedAttr &Attr,
+ FunctionType::RISCVStateValue State) {
+ if (!Attr.getNumArgs()) {
+ S.Diag(Attr.getLoc(), diag::err_missing_riscv_state) << Attr;
+ Attr.setInvalid();
+ return true;
+ }
+
+ for (unsigned I = 0; I < Attr.getNumArgs(); ++I) {
+ StringRef StateName;
+ SourceLocation LiteralLoc;
+ if (!S.checkStringLiteralArgumentAttr(Attr, I, StateName, &LiteralLoc))
+ return true;
+
+ unsigned Shift;
+ FunctionType::RISCVStateValue ExistingState;
+
+ // Determine which tile state this is and get its shift/mask
+ if (StateName == "xsfmm") {
+ Shift = FunctionType::RISCVXsfmmShift;
+ ExistingState = FunctionType::getRISCVXsfmmState(EPI.RISCVAttributes);
+ } else {
+ S.Diag(LiteralLoc, diag::err_unknown_riscv_state) << StateName;
+ Attr.setInvalid();
+ return true;
+ }
+
+ // __riscv_in, __riscv_out, __riscv_inout, __riscv_preserves, and
+ // __riscv_new are all mutually exclusive for the same state,
+ // so check if there are conflicting attributes.
----------------
lenary wrote:
I guess there's two different "interpretations" of `__riscv_in` and
`__riscv_out`.
One is "this state is *only* an input/output", or "this state is an
input/output". I think the "only" that's currently there gets lost a little,
and there's a reasonable expectation that saying "this state is an input" and
"this state is an output" separately is equivalent to "this state is both an
input and an output".
https://github.com/llvm/llvm-project/pull/206260
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits