[llvm] [AArch64][NFC] Avoid relocations in LdStNInstrDesc (PR #202025)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 08:53:42 PDT 2026


https://github.com/aengelke updated https://github.com/llvm/llvm-project/pull/202025

>From db8555133937de4a3dc11535768ef5db8fae3ecf Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Sat, 6 Jun 2026 10:17:37 +0000
Subject: [PATCH 1/2] [spr] initial version

Created using spr 1.3.8-wip
---
 llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
index 2df769539960d..4e4b58839778b 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
@@ -421,8 +421,8 @@ static bool isTblTbxInstruction(unsigned Opcode, StringRef &Layout,
 
 struct LdStNInstrDesc {
   unsigned Opcode;
-  const char *Mnemonic;
-  const char *Layout;
+  char Mnemonic[6];
+  char Layout[6];
   int ListOperand;
   bool HasLane;
   int NaturalOffset;

>From 6e40957e57fc1e75023fbbd64ee842c8d5daef5e Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Tue, 9 Jun 2026 15:53:05 +0000
Subject: [PATCH 2/2] compress further

Created using spr 1.3.8-wip
---
 .../AArch64/MCTargetDesc/AArch64InstPrinter.cpp      | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
index 4e4b58839778b..9134203a2da2a 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
@@ -421,11 +421,11 @@ static bool isTblTbxInstruction(unsigned Opcode, StringRef &Layout,
 
 struct LdStNInstrDesc {
   unsigned Opcode;
-  char Mnemonic[6];
-  char Layout[6];
-  int ListOperand;
-  bool HasLane;
-  int NaturalOffset;
+  char Mnemonic[5];
+  char Layout[5];
+  uint8_t ListOperand : 2;
+  uint8_t HasLane : 1;
+  uint8_t NaturalOffset;
 };
 
 static const LdStNInstrDesc LdStNInstInfo[] = {
@@ -827,7 +827,7 @@ void AArch64AppleInstPrinter::printInst(const MCInst *MI, uint64_t Address,
       } else {
         assert(LdStDesc->NaturalOffset && "no offset on post-inc instruction?");
         O << ", ";
-        markup(O, Markup::Immediate) << "#" << LdStDesc->NaturalOffset;
+        markup(O, Markup::Immediate) << "#" << int(LdStDesc->NaturalOffset);
       }
     }
 



More information about the llvm-commits mailing list