[llvm] [M68k] Remove STI from M68kAsmParser (PR #159827)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 19 12:24:00 PDT 2025


https://github.com/s-barannikov updated https://github.com/llvm/llvm-project/pull/159827

>From e741242e65d5c3329ea047194ad659d9308cde0c Mon Sep 17 00:00:00 2001
From: Sergei Barannikov <barannikov88 at gmail.com>
Date: Fri, 19 Sep 2025 21:21:01 +0300
Subject: [PATCH] [M68k] Remove STI from M68kAsmParser

This already exists in the base class.
This resolves a build error:

```
lib/Target/M68k/M68kGenAsmMatcher.inc:2633:60: error: indirection requires pointer operand ('const MCSubtargetInfo' invalid)
 2633 |       unsigned Diag = validateOperandClass(Actual, Formal, *STI);
      |                                                            ^~~~
1 error generated.
```
---
 llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp b/llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp
index 16f97d971840b..3e9666f586e0f 100644
--- a/llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp
+++ b/llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp
@@ -32,7 +32,6 @@ static cl::opt<bool> RegisterPrefixOptional(
 namespace {
 /// Parses M68k assembly from a stream.
 class M68kAsmParser : public MCTargetAsmParser {
-  const MCSubtargetInfo &STI;
   MCAsmParser &Parser;
   const MCRegisterInfo *MRI;
 
@@ -58,7 +57,7 @@ class M68kAsmParser : public MCTargetAsmParser {
 public:
   M68kAsmParser(const MCSubtargetInfo &STI, MCAsmParser &Parser,
                 const MCInstrInfo &MII, const MCTargetOptions &Options)
-      : MCTargetAsmParser(Options, STI, MII), STI(STI), Parser(Parser) {
+      : MCTargetAsmParser(Options, STI, MII), Parser(Parser) {
     MCAsmParserExtension::Initialize(Parser);
     MRI = getContext().getRegisterInfo();
 
@@ -1024,7 +1023,7 @@ bool M68kAsmParser::missingFeature(llvm::SMLoc const &Loc,
 bool M68kAsmParser::emit(MCInst &Inst, SMLoc const &Loc,
                          MCStreamer &Out) const {
   Inst.setLoc(Loc);
-  Out.emitInstruction(Inst, STI);
+  Out.emitInstruction(Inst, *STI);
 
   return false;
 }



More information about the llvm-commits mailing list