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

Carl Peto via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 14 16:26:17 PST 2023


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

>From 333916a07e90955564d03f14e004695802d9f618 Mon Sep 17 00:00:00 2001
From: Carl Peto <carl.peto at 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..ae141d3f485139c 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 {



More information about the cfe-commits mailing list