[clang] [AVR] make the AVR ABI Swift compatible (PR #72298)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 14 10:47:58 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-codegen

Author: Carl Peto (carlos4242)

<details>
<summary>Changes</summary>

This patch is needed to add support to clang's AVR ABI for the Swift language. It is a pre-requisite for adding AVR support to the public Swift compiler itself.

I'm open to any suggestions how I might create suitable unit tests for this?

@<!-- -->benshi001 @<!-- -->rjmccall

---
Full diff: https://github.com/llvm/llvm-project/pull/72298.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/Targets/AVR.cpp (+4-1) 


``````````diff
diff --git a/clang/lib/CodeGen/Targets/AVR.cpp b/clang/lib/CodeGen/Targets/AVR.cpp
index 50547dd6dec5e7d..bc6418c1e224eb4 100644
--- a/clang/lib/CodeGen/Targets/AVR.cpp
+++ b/clang/lib/CodeGen/Targets/AVR.cpp
@@ -112,7 +112,10 @@ class AVRABIInfo : public DefaultABIInfo {
 class AVRTargetCodeGenInfo : public TargetCodeGenInfo {
 public:
   AVRTargetCodeGenInfo(CodeGenTypes &CGT, unsigned NPR, unsigned NRR)
-      : TargetCodeGenInfo(std::make_unique<AVRABIInfo>(CGT, NPR, NRR)) {}
+      : TargetCodeGenInfo(std::make_unique<AVRABIInfo>(CGT, NPR, NRR)) {
+        SwiftInfo =
+          std::make_unique<SwiftABIInfo>(CGT, /*SwiftErrorInRegister=*/true);
+      }
 
   LangAS getGlobalVarAddressSpace(CodeGenModule &CGM,
                                   const VarDecl *D) const override {

``````````

</details>


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


More information about the cfe-commits mailing list