[clang] [llvm] [RISCV] Add support for Swift calling conventions and error handling (PR #205469)

Jessica Clarke via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 23 20:06:27 PDT 2026


================
@@ -399,6 +400,32 @@ static bool CC_RISCV_Impl(unsigned ValNo, MVT ValVT, MVT LocVT,
     }
   }
 
+  // Swift calling convention special registers. Use callee-saved s-registers
+  // so they survive across call boundaries without extra save/restore overhead.
+  // X18(s2)=SwiftSelf, X19(s3)=SwiftError, X20(s4)=SwiftAsync,
+  // X18-X20 exceed the 16-register limit of RVE; fall
+  // through to normal allocation on E-variant ABIs.
+  if (LocVT == XLenVT && !IsEABI) {
----------------
jrtc27 wrote:

What if LocVT != XLenVT but isSwiftSelf/Error/Async return true? Is that valid input, or should that be treated as an error?

https://github.com/llvm/llvm-project/pull/205469


More information about the cfe-commits mailing list