[llvm] 89909d8 - AVRAsmBackend: Don't use the MCSubtargetInfo argument

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri May 23 20:41:49 PDT 2025


Author: Fangrui Song
Date: 2025-05-23T20:41:44-07:00
New Revision: 89909d826a3ea7f8dd2f99e082064a684257da85

URL: https://github.com/llvm/llvm-project/commit/89909d826a3ea7f8dd2f99e082064a684257da85
DIFF: https://github.com/llvm/llvm-project/commit/89909d826a3ea7f8dd2f99e082064a684257da85.diff

LOG: AVRAsmBackend: Don't use the MCSubtargetInfo argument

The argument will be removed from `addReloc`.
Use MCContext::getSubtargetInfo instead, to be consistent with other
adjustRelativeBranch calls.

Added: 
    

Modified: 
    llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
    llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp b/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
index da259c6dd1ffa..fbdff56cfb326 100644
--- a/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
+++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
@@ -377,7 +377,7 @@ bool AVRAsmBackend::addReloc(MCAssembler &Asm, const MCFragment &F,
   if (IsResolved) {
     auto TargetVal = MCValue::get(Target.getAddSym(), Target.getSubSym(),
                                   FixedValue, Target.getSpecifier());
-    if (forceRelocation(Asm, Fixup, TargetVal, STI))
+    if (forceRelocation(Asm, F, Fixup, TargetVal))
       IsResolved = false;
   }
   if (!IsResolved)
@@ -515,9 +515,9 @@ bool AVRAsmBackend::writeNopData(raw_ostream &OS, uint64_t Count,
   return true;
 }
 
-bool AVRAsmBackend::forceRelocation(const MCAssembler &Asm,
-                                    const MCFixup &Fixup, const MCValue &Target,
-                                    const MCSubtargetInfo *STI) {
+bool AVRAsmBackend::forceRelocation(const MCAssembler &Asm, const MCFragment &F,
+                                    const MCFixup &Fixup,
+                                    const MCValue &Target) {
   switch ((unsigned)Fixup.getKind()) {
   default:
     return false;
@@ -532,7 +532,8 @@ bool AVRAsmBackend::forceRelocation(const MCAssembler &Asm,
     // Note that trying to actually link that relocation *would* fail, but the
     // hopes are that the module we're currently compiling won't be actually
     // linked to the final binary.
-    return !adjust::adjustRelativeBranch(Size, Fixup, Offset, STI);
+    return !adjust::adjustRelativeBranch(Size, Fixup, Offset,
+                                         Asm.getContext().getSubtargetInfo());
   }
 
   case AVR::fixup_call:

diff  --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h b/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h
index 66f83f221e0c1..7752e4394fc83 100644
--- a/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h
+++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h
@@ -52,8 +52,8 @@ class AVRAsmBackend : public MCAsmBackend {
   bool writeNopData(raw_ostream &OS, uint64_t Count,
                     const MCSubtargetInfo *STI) const override;
 
-  bool forceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
-                       const MCValue &Target, const MCSubtargetInfo *);
+  bool forceRelocation(const MCAssembler &Asm, const MCFragment &F,
+                       const MCFixup &Fixup, const MCValue &Target);
 
 private:
   Triple::OSType OSType;


        


More information about the llvm-commits mailing list