[PATCH] D59893: [MC] Remove unused `NONE` fixup kinds. NFC.

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 27 10:26:10 PDT 2019


sbc100 created this revision.
Herald added subscribers: llvm-commits, atanasyan, jrtc27, aheejin, hiraditya, arichardson, sdardis.
Herald added a project: LLVM.

The Mips and Lanai targets included MCFixupKind corresponding the
their NONE relocation types.  However these were:

a. never used
b. not included by any other targets in the Fixup enum

As far as I can tell llvm never generated relocs of type NONE so these
fixup types don't need to exist.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D59893

Files:
  llvm/lib/Target/Lanai/MCTargetDesc/LanaiAsmBackend.cpp
  llvm/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp
  llvm/lib/Target/Lanai/MCTargetDesc/LanaiFixupKinds.h
  llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
  llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
  llvm/lib/Target/Mips/MCTargetDesc/MipsFixupKinds.h


Index: llvm/lib/Target/Mips/MCTargetDesc/MipsFixupKinds.h
===================================================================
--- llvm/lib/Target/Mips/MCTargetDesc/MipsFixupKinds.h
+++ llvm/lib/Target/Mips/MCTargetDesc/MipsFixupKinds.h
@@ -22,11 +22,8 @@
   // in MipsAsmBackend.cpp.
   //
   enum Fixups {
-    // Branch fixups resulting in R_MIPS_NONE.
-    fixup_Mips_NONE = FirstTargetFixupKind,
-
     // Branch fixups resulting in R_MIPS_16.
-    fixup_Mips_16,
+    fixup_Mips_16 = FirstTargetFixupKind,
 
     // Pure 32 bit data fixup resulting in - R_MIPS_32.
     fixup_Mips_32,
Index: llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
===================================================================
--- llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
+++ llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
@@ -222,8 +222,6 @@
   unsigned Kind = (unsigned)Fixup.getKind();
 
   switch (Kind) {
-  case Mips::fixup_Mips_NONE:
-    return ELF::R_MIPS_NONE;
   case FK_Data_1:
     Ctx.reportError(Fixup.getLoc(),
                     "MIPS does not support one byte relocations");
Index: llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
===================================================================
--- llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
+++ llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
@@ -302,7 +302,6 @@
 
 Optional<MCFixupKind> MipsAsmBackend::getFixupKind(StringRef Name) const {
   return StringSwitch<Optional<MCFixupKind>>(Name)
-      .Case("R_MIPS_NONE", (MCFixupKind)Mips::fixup_Mips_NONE)
       .Case("R_MIPS_32", FK_Data_4)
       .Case("R_MIPS_GOT_PAGE", (MCFixupKind)Mips::fixup_Mips_GOT_PAGE)
       .Case("R_MIPS_CALL_HI16", (MCFixupKind)Mips::fixup_Mips_CALL_HI16)
@@ -350,7 +349,6 @@
     // MipsFixupKinds.h.
     //
     // name                    offset  bits  flags
-    { "fixup_Mips_NONE",         0,      0,   0 },
     { "fixup_Mips_16",           0,     16,   0 },
     { "fixup_Mips_32",           0,     32,   0 },
     { "fixup_Mips_REL32",        0,     32,   0 },
@@ -430,7 +428,6 @@
     // MipsFixupKinds.h.
     //
     // name                    offset  bits  flags
-    { "fixup_Mips_NONE",         0,      0,   0 },
     { "fixup_Mips_16",          16,     16,   0 },
     { "fixup_Mips_32",           0,     32,   0 },
     { "fixup_Mips_REL32",        0,     32,   0 },
Index: llvm/lib/Target/Lanai/MCTargetDesc/LanaiFixupKinds.h
===================================================================
--- llvm/lib/Target/Lanai/MCTargetDesc/LanaiFixupKinds.h
+++ llvm/lib/Target/Lanai/MCTargetDesc/LanaiFixupKinds.h
@@ -22,10 +22,7 @@
 // in LanaiAsmBackend.cpp.
 //
 enum Fixups {
-  // Results in R_Lanai_NONE
-  FIXUP_LANAI_NONE = FirstTargetFixupKind,
-
-  FIXUP_LANAI_21,   // 21-bit symbol relocation
+  FIXUP_LANAI_21 = FirstTargetFixupKind, // 21-bit symbol relocation
   FIXUP_LANAI_21_F, // 21-bit symbol relocation, last two bits masked to 0
   FIXUP_LANAI_25,   // 25-bit branch targets
   FIXUP_LANAI_32,   // general 32-bit relocation
Index: llvm/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp
===================================================================
--- llvm/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp
+++ llvm/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp
@@ -62,9 +62,6 @@
   case Lanai::FIXUP_LANAI_LO16:
     Type = ELF::R_LANAI_LO16;
     break;
-  case Lanai::FIXUP_LANAI_NONE:
-    Type = ELF::R_LANAI_NONE;
-    break;
 
   default:
     llvm_unreachable("Invalid fixup kind!");
Index: llvm/lib/Target/Lanai/MCTargetDesc/LanaiAsmBackend.cpp
===================================================================
--- llvm/lib/Target/Lanai/MCTargetDesc/LanaiAsmBackend.cpp
+++ llvm/lib/Target/Lanai/MCTargetDesc/LanaiAsmBackend.cpp
@@ -147,7 +147,6 @@
       //   no bits are set in the fixup range.
       //
       // name          offset bits flags
-      {"FIXUP_LANAI_NONE", 0, 32, 0},
       {"FIXUP_LANAI_21", 16, 16 /*21*/, 0},
       {"FIXUP_LANAI_21_F", 16, 16 /*21*/, 0},
       {"FIXUP_LANAI_25", 7, 25, 0},


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59893.192471.patch
Type: text/x-patch
Size: 4090 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190327/2a8f0991/attachment.bin>


More information about the llvm-commits mailing list