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

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

>From ed8b63c31f8b9a496bc5c51ab83a132c224594f0 Mon Sep 17 00:00:00 2001
From: Carl Peto <carl.p...@me.com>
Date: Tue, 14 Nov 2023 17:27:37 +0000
Subject: [PATCH] [AVR] make the AVR ABI Swift compatible

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

@benshi001 @rjmccall
---
 clang/lib/CodeGen/Targets/AVR.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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 {

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to