[clang] [llvm] [AVR] Only specify one legal int string in data layout (PR #153010)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 11 07:17:59 PDT 2025


https://github.com/nikic created https://github.com/llvm/llvm-project/pull/153010

There should not be both `n8` and `n16:8`. This is a single list of legal integers. Additionally, this should use the standard order in increasing size `n8:16`.

>From 17d75aaec45a1feefa3f96289fd115c1200bb5fd Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Mon, 11 Aug 2025 16:16:20 +0200
Subject: [PATCH] [AVR] Only specify one legal int string in data layout

There should not be both `n8` and `n16:8`. This is a single list
of legal integers. Additionally, this should use the standard
order in increasing size `n8:16`.
---
 clang/lib/Basic/Targets/AVR.h            | 3 +--
 llvm/lib/Target/AVR/AVRTargetMachine.cpp | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Basic/Targets/AVR.h b/clang/lib/Basic/Targets/AVR.h
index 11aa844f2ce55..b666778659603 100644
--- a/clang/lib/Basic/Targets/AVR.h
+++ b/clang/lib/Basic/Targets/AVR.h
@@ -57,8 +57,7 @@ class LLVM_LIBRARY_VISIBILITY AVRTargetInfo : public TargetInfo {
     Int16Type = SignedInt;
     Char32Type = UnsignedLong;
     SigAtomicType = SignedChar;
-    resetDataLayout(
-        "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-n16:8-a:8");
+    resetDataLayout("e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8:16-a:8");
   }
 
   void getTargetDefines(const LangOptions &Opts,
diff --git a/llvm/lib/Target/AVR/AVRTargetMachine.cpp b/llvm/lib/Target/AVR/AVRTargetMachine.cpp
index 02212d2151f4c..fbd148478c894 100644
--- a/llvm/lib/Target/AVR/AVRTargetMachine.cpp
+++ b/llvm/lib/Target/AVR/AVRTargetMachine.cpp
@@ -29,7 +29,7 @@
 namespace llvm {
 
 static const char *AVRDataLayout =
-    "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-n16:8-a:8";
+    "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8:16-a:8";
 
 /// Processes a CPU name.
 static StringRef getCPU(StringRef CPU) {



More information about the cfe-commits mailing list