[llvm] 1d13342 - [MC] Use FirstTargetSpecifier

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


Author: Fangrui Song
Date: 2025-03-21T23:25:38-07:00
New Revision: 1d133420dc512487e2be0e9d86755f2a7c3497a7

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

LOG: [MC] Use FirstTargetSpecifier

Added: 
    

Modified: 
    llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.h
    llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
    llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.h b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.h
index 1d0451046b6e2..07404859f36f4 100644
--- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.h
+++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.h
@@ -14,12 +14,10 @@
 namespace llvm {
 class HexagonMCExpr : public MCTargetExpr {
 public:
-  enum VariantKind {
+  enum VariantKind : uint8_t {
     VK_None,
 
-    // While not strictly necessary, start at a larger number to avoid confusion
-    // with MCSymbolRefExpr::VariantKind.
-    VK_DTPREL = 100,
+    VK_DTPREL = MCSymbolRefExpr::FirstTargetSpecifier,
     VK_GD_GOT,
     VK_GD_PLT,
     VK_GOT,

diff  --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
index 2288280296617..62216a9d79dd6 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
@@ -17,12 +17,10 @@ namespace llvm {
 
 class PPCMCExpr : public MCTargetExpr {
 public:
-  enum Specifier {
+  enum Specifier : uint8_t {
     VK_None,
 
-    // We currently use both MCSymbolRefExpr::VariantKind and
-    // PPCMCExpr::Specifier. Start at a larger number to avoid conflicts.
-    VK_LO = 200,
+    VK_LO = MCSymbolRefExpr::FirstTargetSpecifier,
     VK_HI,
     VK_HA,
     VK_HIGH,

diff  --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
index 1690bd75b71c4..be2cfeb78163b 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
@@ -22,9 +22,9 @@ class StringRef;
 
 class RISCVMCExpr : public MCTargetExpr {
 public:
-  enum Specifier {
+  enum Specifier : uint8_t {
     VK_None,
-    VK_LO,
+    VK_LO = MCSymbolRefExpr::FirstTargetSpecifier,
     VK_HI,
     VK_PCREL_LO,
     VK_PCREL_HI,


        


More information about the llvm-commits mailing list