[clang] [llvm] [RISCV][clang] Support XSfmm ABI attributes (PR #206260)
Brandon Wu via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 18 21:00:25 PDT 2026
================
@@ -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.
----------------
4vtomat wrote:
Umm I think that might be confused or ambiguous to user if we try to make any call with `riscv_in` in `riscv_out` or other way around? Or is there any use case for this lol?
https://github.com/llvm/llvm-project/pull/206260
More information about the cfe-commits
mailing list