[lld] r280222 - [ELF][MIPS] Inline function. NFC

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 04:47:17 PDT 2016


Author: atanasyan
Date: Wed Aug 31 06:47:17 2016
New Revision: 280222

URL: http://llvm.org/viewvc/llvm-project?rev=280222&view=rev
Log:
[ELF][MIPS] Inline function. NFC

Modified:
    lld/trunk/ELF/Target.cpp

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=280222&r1=280221&r2=280222&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Wed Aug 31 06:47:17 2016
@@ -1942,8 +1942,6 @@ void MipsTargetInfo<ELFT>::writeGotPlt(u
   write32<ELFT::TargetEndianness>(Buf, Out<ELFT>::Plt->getVA());
 }
 
-static uint16_t mipsHigh(uint64_t V) { return (V + 0x8000) >> 16; }
-
 template <endianness E, uint8_t BSIZE, uint8_t SHIFT>
 static int64_t getPcRelocAddend(const uint8_t *Loc) {
   uint32_t Instr = read32<E>(Loc);
@@ -1964,7 +1962,8 @@ static void applyMipsPcReloc(uint8_t *Lo
 template <endianness E>
 static void writeMipsHi16(uint8_t *Loc, uint64_t V) {
   uint32_t Instr = read32<E>(Loc);
-  write32<E>(Loc, (Instr & 0xffff0000) | mipsHigh(V));
+  uint16_t Res = ((V + 0x8000) >> 16) & 0xffff;
+  write32<E>(Loc, (Instr & 0xffff0000) | Res);
 }
 
 template <endianness E>




More information about the llvm-commits mailing list