]> granicus.if.org Git - llvm/commitdiff
[mips] Do not pass redundant IsN64 flag to MCELFObjectTargetWriter. NFC
authorSimon Atanasyan <simon@atanasyan.com>
Thu, 21 Sep 2017 14:04:47 +0000 (14:04 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Thu, 21 Sep 2017 14:04:47 +0000 (14:04 +0000)
Now we pass the 'Is64_' flag to the MCELFObjectTargetWriter ctor iif
when we make deal with N64 ABI. So it is redundant to pass additional
'IsN64' flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313878 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCELFObjectWriter.h
lib/MC/ELFObjectWriter.cpp
lib/MC/MCELFObjectTargetWriter.cpp
lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp

index 2efd37924e2efabb91c6f2d2699245a01bc2a2c3..d32b56a4ba0877026fc8ba00703873f3d633854e 100644 (file)
@@ -55,11 +55,10 @@ class MCELFObjectTargetWriter {
   const uint16_t EMachine;
   const unsigned HasRelocationAddend : 1;
   const unsigned Is64Bit : 1;
-  const unsigned IsN64 : 1;
 
 protected:
   MCELFObjectTargetWriter(bool Is64Bit_, uint8_t OSABI_, uint16_t EMachine_,
-                          bool HasRelocationAddend, bool IsN64 = false);
+                          bool HasRelocationAddend);
 
 public:
   virtual ~MCELFObjectTargetWriter() = default;
@@ -91,7 +90,6 @@ public:
   uint16_t getEMachine() const { return EMachine; }
   bool hasRelocationAddend() const { return HasRelocationAddend; }
   bool is64Bit() const { return Is64Bit; }
-  bool isN64() const { return IsN64; }
   /// @}
 
   // Instead of changing everyone's API we pack the N64 Type fields
index c8dd6301194391e97c7f38a0d8773d2863d9bdab..b37a950908effa370ba38355d01d9a3989bdd1fa 100644 (file)
@@ -1108,7 +1108,7 @@ void ELFObjectWriter::writeRelocations(const MCAssembler &Asm,
 
     if (is64Bit()) {
       write(Entry.Offset);
-      if (TargetObjectWriter->isN64()) {
+      if (TargetObjectWriter->getEMachine() == ELF::EM_MIPS) {
         write(uint32_t(Index));
 
         write(TargetObjectWriter->getRSsym(Entry.Type));
index 68fb5e7cbb3dd128023ec6103d7000554751e679..483ee94c0db1e47b7044eaf606034282d7de6a2d 100644 (file)
 
 using namespace llvm;
 
-MCELFObjectTargetWriter::MCELFObjectTargetWriter(bool Is64Bit_,
-                                                 uint8_t OSABI_,
+MCELFObjectTargetWriter::MCELFObjectTargetWriter(bool Is64Bit_, uint8_t OSABI_,
                                                  uint16_t EMachine_,
-                                                 bool HasRelocationAddend_,
-                                                 bool IsN64_)
-  : OSABI(OSABI_), EMachine(EMachine_),
-    HasRelocationAddend(HasRelocationAddend_), Is64Bit(Is64Bit_),
-    IsN64(IsN64_){
-}
+                                                 bool HasRelocationAddend_)
+    : OSABI(OSABI_), EMachine(EMachine_),
+      HasRelocationAddend(HasRelocationAddend_), Is64Bit(Is64Bit_) {}
 
 bool MCELFObjectTargetWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
                                                       unsigned Type) const {
index 5c78799996f91c35872f15a61920edefde8fe7dc..4339eca93f1475c6e37b845187704e00e75a40a4 100644 (file)
@@ -55,7 +55,7 @@ raw_ostream &operator<<(raw_ostream &OS, const MipsRelocationEntry &RHS) {
 
 class MipsELFObjectWriter : public MCELFObjectTargetWriter {
 public:
-  MipsELFObjectWriter(uint8_t OSABI, bool HasRelocationAddend, bool IsN64,
+  MipsELFObjectWriter(uint8_t OSABI, bool HasRelocationAddend, bool Is64,
                       bool IsLittleEndian);
 
   ~MipsELFObjectWriter() override = default;
@@ -210,10 +210,9 @@ static void dumpRelocs(const char *Prefix, const Container &Relocs) {
 #endif
 
 MipsELFObjectWriter::MipsELFObjectWriter(uint8_t OSABI,
-                                         bool HasRelocationAddend, bool IsN64,
+                                         bool HasRelocationAddend, bool Is64,
                                          bool IsLittleEndian)
-    : MCELFObjectTargetWriter(IsN64, OSABI, ELF::EM_MIPS, HasRelocationAddend,
-                              IsN64) {}
+    : MCELFObjectTargetWriter(Is64, OSABI, ELF::EM_MIPS, HasRelocationAddend) {}
 
 unsigned MipsELFObjectWriter::getRelocType(MCContext &Ctx,
                                            const MCValue &Target,
@@ -282,7 +281,7 @@ unsigned MipsELFObjectWriter::getRelocType(MCContext &Ctx,
   case FK_TPRel_8:
     return ELF::R_MIPS_TLS_TPREL64;
   case FK_GPRel_4:
-    if (isN64()) {
+    if (is64Bit()) {
       unsigned Type = (unsigned)ELF::R_MIPS_NONE;
       Type = setRType((unsigned)ELF::R_MIPS_GPREL32, Type);
       Type = setRType2((unsigned)ELF::R_MIPS_64, Type);