[llvm] 4b41799 - [CodeGen] Rename PLTRelativeVariantKind. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 21 23:02:14 PDT 2025


Author: Fangrui Song
Date: 2025-03-21T23:02:08-07:00
New Revision: 4b417992dd95060f5815fdfacb08f1c898f85b41

URL: https://github.com/llvm/llvm-project/commit/4b417992dd95060f5815fdfacb08f1c898f85b41
DIFF: https://github.com/llvm/llvm-project/commit/4b417992dd95060f5815fdfacb08f1c898f85b41.diff

LOG: [CodeGen] Rename PLTRelativeVariantKind. NFC

Migrate away from the deprecated MCSymbolRefExpr::VariantKind.
The name "Specifier" is utilized in a few *MCExpr.

> "Relocation specifier" is clear, aligns with Arm and IBM AIX's documentation, and fits the assembler's role seamlessly.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
    llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    llvm/lib/Target/AArch64/AArch64TargetObjectFile.h
    llvm/lib/Target/ARM/ARMTargetObjectFile.cpp
    llvm/lib/Target/RISCV/RISCVTargetObjectFile.cpp
    llvm/lib/Target/X86/X86TargetObjectFile.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h b/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
index 10f0594c267ae..7392963bd341f 100644
--- a/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
+++ b/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
@@ -37,8 +37,7 @@ class TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
   SmallPtrSet<GlobalObject *, 2> Used;
 
 protected:
-  MCSymbolRefExpr::VariantKind PLTRelativeVariantKind =
-      MCSymbolRefExpr::VK_None;
+  uint8_t PLTRelativeSpecifier = 0;
 
 public:
   TargetLoweringObjectFileELF();

diff  --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 00e4533559c28..27a70e6f775b3 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -1189,7 +1189,7 @@ const MCExpr *TargetLoweringObjectFileELF::lowerRelativeReference(
     return nullptr;
 
   return MCBinaryExpr::createSub(
-      MCSymbolRefExpr::create(TM.getSymbol(LHS), PLTRelativeVariantKind,
+      MCSymbolRefExpr::create(TM.getSymbol(LHS), PLTRelativeSpecifier,
                               getContext()),
       MCSymbolRefExpr::create(TM.getSymbol(RHS), getContext()), getContext());
 }
@@ -1204,7 +1204,7 @@ const MCExpr *TargetLoweringObjectFileELF::lowerDSOLocalEquivalent(
   if (GV->isDSOLocal() || GV->isImplicitDSOLocal())
     return MCSymbolRefExpr::create(TM.getSymbol(GV), getContext());
 
-  return MCSymbolRefExpr::create(TM.getSymbol(GV), PLTRelativeVariantKind,
+  return MCSymbolRefExpr::create(TM.getSymbol(GV), PLTRelativeSpecifier,
                                  getContext());
 }
 

diff  --git a/llvm/lib/Target/AArch64/AArch64TargetObjectFile.h b/llvm/lib/Target/AArch64/AArch64TargetObjectFile.h
index 3e9cd51b742a2..de79acd229873 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetObjectFile.h
+++ b/llvm/lib/Target/AArch64/AArch64TargetObjectFile.h
@@ -21,7 +21,7 @@ class AArch64_ELFTargetObjectFile : public TargetLoweringObjectFileELF {
 
 public:
   AArch64_ELFTargetObjectFile() {
-    PLTRelativeVariantKind = MCSymbolRefExpr::VK_PLT;
+    PLTRelativeSpecifier = MCSymbolRefExpr::VK_PLT;
     SupportIndirectSymViaGOTPCRel = true;
   }
 

diff  --git a/llvm/lib/Target/ARM/ARMTargetObjectFile.cpp b/llvm/lib/Target/ARM/ARMTargetObjectFile.cpp
index 8c53d8b11579b..29abd9e58e2ef 100644
--- a/llvm/lib/Target/ARM/ARMTargetObjectFile.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetObjectFile.cpp
@@ -29,7 +29,7 @@ using namespace dwarf;
 //===----------------------------------------------------------------------===//
 
 ARMElfTargetObjectFile::ARMElfTargetObjectFile() {
-  PLTRelativeVariantKind = MCSymbolRefExpr::VK_ARM_PREL31;
+  PLTRelativeSpecifier = MCSymbolRefExpr::VK_ARM_PREL31;
   SupportIndirectSymViaGOTPCRel = true;
 }
 

diff  --git a/llvm/lib/Target/RISCV/RISCVTargetObjectFile.cpp b/llvm/lib/Target/RISCV/RISCVTargetObjectFile.cpp
index cba191263fc02..fc9160768a7b0 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetObjectFile.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetObjectFile.cpp
@@ -26,7 +26,7 @@ void RISCVELFTargetObjectFile::Initialize(MCContext &Ctx,
                                           const TargetMachine &TM) {
   TargetLoweringObjectFileELF::Initialize(Ctx, TM);
 
-  PLTRelativeVariantKind = MCSymbolRefExpr::VK_PLT;
+  PLTRelativeSpecifier = MCSymbolRefExpr::VK_PLT;
   SupportIndirectSymViaGOTPCRel = true;
 
   SmallDataSection = getContext().getELFSection(

diff  --git a/llvm/lib/Target/X86/X86TargetObjectFile.cpp b/llvm/lib/Target/X86/X86TargetObjectFile.cpp
index d40fc37773dc4..4be0111a21955 100644
--- a/llvm/lib/Target/X86/X86TargetObjectFile.cpp
+++ b/llvm/lib/Target/X86/X86TargetObjectFile.cpp
@@ -54,7 +54,7 @@ const MCExpr *X86_64MachoTargetObjectFile::getIndirectSymViaGOTPCRel(
 }
 
 X86ELFTargetObjectFile::X86ELFTargetObjectFile() {
-  PLTRelativeVariantKind = MCSymbolRefExpr::VariantKind(X86MCExpr::VK_PLT);
+  PLTRelativeSpecifier = X86MCExpr::VK_PLT;
 }
 
 const MCExpr *X86ELFTargetObjectFile::getDebugThreadLocalSymbol(


        


More information about the llvm-commits mailing list