[llvm] [M68k] Fix register class of index operands (PR #156146)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 29 23:19:03 PDT 2025


https://github.com/s-barannikov created https://github.com/llvm/llvm-project/pull/156146

Index operands can only be DR registers.


>From fb46b32606d6d9734e405b3f2236cc6541048610 Mon Sep 17 00:00:00 2001
From: Sergei Barannikov <barannikov88 at gmail.com>
Date: Sat, 30 Aug 2025 09:15:48 +0300
Subject: [PATCH] [M68k] Fix register class of index operands on some
 instructions

Index operands can only be DR registers.
---
 llvm/lib/Target/M68k/M68kInstrInfo.td | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Target/M68k/M68kInstrInfo.td b/llvm/lib/Target/M68k/M68kInstrInfo.td
index 1200c493f9fca..fe839015eaf67 100644
--- a/llvm/lib/Target/M68k/M68kInstrInfo.td
+++ b/llvm/lib/Target/M68k/M68kInstrInfo.td
@@ -344,8 +344,8 @@ foreach size = ["8", "16", "32"] in {
 def MxARII       : MxOpClass<"ARII">;
 foreach size = ["8", "16", "32"] in {
   defvar ResSize = !cast<MxSize>("MxSize"#size);
-  def MxARII # size       : MxMemOp<(ops i8imm:$disp, AR32:$reg,    XR32:$index), ResSize, "f", "printARII"#size#"Mem", MxARII>;
-  def MxARII # size # _TC : MxMemOp<(ops i8imm:$disp, AR32_TC:$reg, XR32:$index), ResSize, "f", "printARII"#size#"Mem", MxARII>;
+  def MxARII # size       : MxMemOp<(ops i8imm:$disp, AR32:$reg,    DR32:$index), ResSize, "f", "printARII"#size#"Mem", MxARII>;
+  def MxARII # size # _TC : MxMemOp<(ops i8imm:$disp, AR32_TC:$reg, DR32:$index), ResSize, "f", "printARII"#size#"Mem", MxARII>;
 } // foreach size
 
 // ABSOLUTE SHORT ADDRESS. This addressing mode requires one word of extension.
@@ -394,7 +394,7 @@ def MxPCD # size : MxMemOp<(ops i16imm), ResSize,  "q", "printPCD"#size#"Mem", M
 // word, and the contents of the index register.  The value in the program
 // counter is the address of the extension word. This reference is classified as
 // a program reference.
-def MxPCI # size : MxMemOp<(ops i8imm:$disp, XR32:$index), ResSize,  "k", "printPCI"#size#"Mem", MxPCI>;
+def MxPCI # size : MxMemOp<(ops i8imm:$disp, DR32:$index), ResSize,  "k", "printPCI"#size#"Mem", MxPCI>;
 } // foreach size
 } // OPERAND_PCREL
 



More information about the llvm-commits mailing list