[llvm] 2b43657 - Remove the MCAssembler argument from RISCVAsmBackend::isPCRelFixupResolved

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat May 24 16:11:29 PDT 2025


Author: Fangrui Song
Date: 2025-05-24T16:11:25-07:00
New Revision: 2b436575a5932517de4039fbce014a09170c5c6c

URL: https://github.com/llvm/llvm-project/commit/2b436575a5932517de4039fbce014a09170c5c6c
DIFF: https://github.com/llvm/llvm-project/commit/2b436575a5932517de4039fbce014a09170c5c6c.diff

LOG: Remove the MCAssembler argument from RISCVAsmBackend::isPCRelFixupResolved

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
    llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
index 0bee7209c3726..ff647d4c7fc0c 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
@@ -544,8 +544,7 @@ static uint64_t adjustFixupValue(const MCFixup &Fixup, uint64_t Value,
   }
 }
 
-bool RISCVAsmBackend::isPCRelFixupResolved(const MCAssembler &Asm,
-                                           const MCSymbol *SymA,
+bool RISCVAsmBackend::isPCRelFixupResolved(const MCSymbol *SymA,
                                            const MCFragment &F) {
   // If the section does not contain linker-relaxable instructions, PC-relative
   // fixups can be resolved.
@@ -560,7 +559,7 @@ bool RISCVAsmBackend::isPCRelFixupResolved(const MCAssembler &Asm,
     PCRelTemp = getContext().createTempSymbol();
   PCRelTemp->setFragment(const_cast<MCFragment *>(&F));
   MCValue Res;
-  MCExpr::evaluateSymbolicAdd(&Asm, false, MCValue::get(SymA),
+  MCExpr::evaluateSymbolicAdd(Asm, false, MCValue::get(SymA),
                               MCValue::get(nullptr, PCRelTemp), Res);
   return !Res.getSubSym();
 }
@@ -609,7 +608,7 @@ bool RISCVAsmBackend::evaluateTargetFixup(const MCFixup &Fixup,
   Value -= Asm->getFragmentOffset(*AUIPCDF) + AUIPCFixup->getOffset();
 
   return AUIPCFixup->getTargetKind() == RISCV::fixup_riscv_pcrel_hi20 &&
-         isPCRelFixupResolved(*Asm, AUIPCTarget.getAddSym(), *AUIPCDF);
+         isPCRelFixupResolved(AUIPCTarget.getAddSym(), *AUIPCDF);
 }
 
 bool RISCVAsmBackend::addReloc(const MCFragment &F, const MCFixup &Fixup,
@@ -660,7 +659,7 @@ bool RISCVAsmBackend::addReloc(const MCFragment &F, const MCFixup &Fixup,
     IsResolved = false;
   if (IsResolved &&
       (getFixupKindInfo(Fixup.getKind()).Flags & MCFixupKindInfo::FKF_IsPCRel))
-    IsResolved = isPCRelFixupResolved(*Asm, Target.getAddSym(), F);
+    IsResolved = isPCRelFixupResolved(Target.getAddSym(), F);
   IsResolved = MCAsmBackend::addReloc(F, Fixup, Target, FixedValue, IsResolved);
 
   if (Fixup.isLinkerRelaxable()) {

diff  --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.h
index e411d65304241..4dffbb82e07c7 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.h
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.h
@@ -29,8 +29,7 @@ class RISCVAsmBackend : public MCAsmBackend {
   // Temporary symbol used to check whether a PC-relative fixup is resolved.
   MCSymbol *PCRelTemp = nullptr;
 
-  bool isPCRelFixupResolved(const MCAssembler &Asm, const MCSymbol *SymA,
-                            const MCFragment &F);
+  bool isPCRelFixupResolved(const MCSymbol *SymA, const MCFragment &F);
 
 public:
   RISCVAsmBackend(const MCSubtargetInfo &STI, uint8_t OSABI, bool Is64Bit,


        


More information about the llvm-commits mailing list