[llvm] 70f5632 - [PowerPC,MC] Replace getSymA()->getSymbol() with getAddSym. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 5 13:53:42 PDT 2025


Author: Fangrui Song
Date: 2025-04-05T13:53:38-07:00
New Revision: 70f5632cadb82b1be813d7ba688b80e22df634e2

URL: https://github.com/llvm/llvm-project/commit/70f5632cadb82b1be813d7ba688b80e22df634e2
DIFF: https://github.com/llvm/llvm-project/commit/70f5632cadb82b1be813d7ba688b80e22df634e2.diff

LOG: [PowerPC,MC] Replace getSymA()->getSymbol() with getAddSym. NFC

We will replace the MCSymbolRefExpr member in MCValue with MCSymbol.
This change reduces dependence on MCSymbolRefExpr.

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
index 3063e1e380fd6..5d6999dbcf1b6 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
@@ -169,18 +169,18 @@ class PPCAsmBackend : public MCAsmBackend {
       // If the target symbol has a local entry point we must not attempt
       // to resolve the fixup directly.  Emit a relocation and leave
       // resolution of the final target address to the linker.
-      if (const MCSymbolRefExpr *A = Target.getSymA()) {
-        if (const auto *S = dyn_cast<MCSymbolELF>(&A->getSymbol())) {
+      if (const auto *A = Target.getAddSym()) {
+        if (const auto *S = dyn_cast<MCSymbolELF>(A)) {
           // The "other" values are stored in the last 6 bits of the second
           // byte. The traditional defines for STO values assume the full byte
           // and thus the shift to pack it.
           unsigned Other = S->getOther() << 2;
           if ((Other & ELF::STO_PPC64_LOCAL_MASK) != 0)
             return true;
-        } else if (const auto *S = dyn_cast<MCSymbolXCOFF>(&A->getSymbol())) {
+        } else if (const auto *S = dyn_cast<MCSymbolXCOFF>(A)) {
           return !Target.isAbsolute() && S->isExternal() &&
                  S->getStorageClass() == XCOFF::C_WEAKEXT;
-       }
+        }
       }
       return false;
     }


        


More information about the llvm-commits mailing list