[llvm] b3e64fb - [ARM] Prepare for VariantKind to specifier rename. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 21 10:19:18 PDT 2025


Author: Fangrui Song
Date: 2025-03-21T10:19:13-07:00
New Revision: b3e64fbc31702ea7e4d96fa410888a94223b599e

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

LOG: [ARM] Prepare for VariantKind to specifier rename. NFC

Added: 
    

Modified: 
    llvm/lib/Target/ARM/ARMMCInstLower.cpp
    llvm/lib/Target/ARM/ARMTargetObjectFile.cpp
    llvm/lib/Target/ARM/ARMTargetObjectFile.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/ARMMCInstLower.cpp b/llvm/lib/Target/ARM/ARMMCInstLower.cpp
index 98a95f1aa2eb5..0022adbfeced8 100644
--- a/llvm/lib/Target/ARM/ARMMCInstLower.cpp
+++ b/llvm/lib/Target/ARM/ARMMCInstLower.cpp
@@ -37,41 +37,38 @@ using namespace llvm;
 
 MCOperand ARMAsmPrinter::GetSymbolRef(const MachineOperand &MO,
                                       const MCSymbol *Symbol) {
-  MCSymbolRefExpr::VariantKind SymbolVariant = MCSymbolRefExpr::VK_None;
+  MCSymbolRefExpr::VariantKind Specifier = MCSymbolRefExpr::VK_None;
   if (MO.getTargetFlags() & ARMII::MO_SBREL)
-    SymbolVariant = MCSymbolRefExpr::VK_ARM_SBREL;
+    Specifier = MCSymbolRefExpr::VK_ARM_SBREL;
 
-  const MCExpr *Expr =
-      MCSymbolRefExpr::create(Symbol, SymbolVariant, OutContext);
+  const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, Specifier, OutContext);
   switch (MO.getTargetFlags() & ARMII::MO_OPTION_MASK) {
   default:
     llvm_unreachable("Unknown target flag on symbol operand");
   case ARMII::MO_NO_FLAG:
     break;
   case ARMII::MO_LO16:
-    Expr =
-        MCSymbolRefExpr::create(Symbol, SymbolVariant, OutContext);
+    Expr = MCSymbolRefExpr::create(Symbol, Specifier, OutContext);
     Expr = ARMMCExpr::createLower16(Expr, OutContext);
     break;
   case ARMII::MO_HI16:
-    Expr =
-        MCSymbolRefExpr::create(Symbol, SymbolVariant, OutContext);
+    Expr = MCSymbolRefExpr::create(Symbol, Specifier, OutContext);
     Expr = ARMMCExpr::createUpper16(Expr, OutContext);
     break;
   case ARMII::MO_LO_0_7:
-    Expr = MCSymbolRefExpr::create(Symbol, SymbolVariant, OutContext);
+    Expr = MCSymbolRefExpr::create(Symbol, Specifier, OutContext);
     Expr = ARMMCExpr::createLower0_7(Expr, OutContext);
     break;
   case ARMII::MO_LO_8_15:
-    Expr = MCSymbolRefExpr::create(Symbol, SymbolVariant, OutContext);
+    Expr = MCSymbolRefExpr::create(Symbol, Specifier, OutContext);
     Expr = ARMMCExpr::createLower8_15(Expr, OutContext);
     break;
   case ARMII::MO_HI_0_7:
-    Expr = MCSymbolRefExpr::create(Symbol, SymbolVariant, OutContext);
+    Expr = MCSymbolRefExpr::create(Symbol, Specifier, OutContext);
     Expr = ARMMCExpr::createUpper0_7(Expr, OutContext);
     break;
   case ARMII::MO_HI_8_15:
-    Expr = MCSymbolRefExpr::create(Symbol, SymbolVariant, OutContext);
+    Expr = MCSymbolRefExpr::create(Symbol, Specifier, OutContext);
     Expr = ARMMCExpr::createUpper8_15(Expr, OutContext);
     break;
   }

diff  --git a/llvm/lib/Target/ARM/ARMTargetObjectFile.cpp b/llvm/lib/Target/ARM/ARMTargetObjectFile.cpp
index cd231896d691b..8c53d8b11579b 100644
--- a/llvm/lib/Target/ARM/ARMTargetObjectFile.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetObjectFile.cpp
@@ -28,6 +28,11 @@ using namespace dwarf;
 //                               ELF Target
 //===----------------------------------------------------------------------===//
 
+ARMElfTargetObjectFile::ARMElfTargetObjectFile() {
+  PLTRelativeVariantKind = MCSymbolRefExpr::VK_ARM_PREL31;
+  SupportIndirectSymViaGOTPCRel = true;
+}
+
 void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
                                         const TargetMachine &TM) {
   const ARMBaseTargetMachine &ARM_TM = static_cast<const ARMBaseTargetMachine &>(TM);

diff  --git a/llvm/lib/Target/ARM/ARMTargetObjectFile.h b/llvm/lib/Target/ARM/ARMTargetObjectFile.h
index 7d771d2242045..e2cce9b79e057 100644
--- a/llvm/lib/Target/ARM/ARMTargetObjectFile.h
+++ b/llvm/lib/Target/ARM/ARMTargetObjectFile.h
@@ -17,11 +17,7 @@ namespace llvm {
 
 class ARMElfTargetObjectFile : public TargetLoweringObjectFileELF {
 public:
-  ARMElfTargetObjectFile() {
-    PLTRelativeVariantKind = MCSymbolRefExpr::VK_ARM_PREL31;
-    SupportIndirectSymViaGOTPCRel = true;
-  }
-
+  ARMElfTargetObjectFile();
   void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
 
   MCRegister getStaticBase() const override;


        


More information about the llvm-commits mailing list