Simplify writeThunk. NFC.

Previously, `Buf + 4` was written twice.

llvm-svn: 273337
This commit is contained in:
Rui Ueyama 2016-06-21 23:53:08 +00:00
parent 21521891a2
commit 39061a5220
1 changed files with 4 additions and 5 deletions

View File

@ -1839,12 +1839,11 @@ void MipsTargetInfo<ELFT>::writeThunk(uint8_t *Buf, uint64_t S) const {
// Write MIPS LA25 thunk code to call PIC function from the non-PIC one.
// See MipsTargetInfo::writeThunk for details.
const endianness E = ELFT::TargetEndianness;
write32<E>(Buf, 0x3c190000); // lui $25, %hi(func)
write32<E>(Buf + 4, 0x08000000); // j func
write32<E>(Buf + 8, 0x27390000); // addiu $25, $25, %lo(func)
write32<E>(Buf + 12, 0x00000000); // nop
write32<E>(Buf, 0x3c190000); // lui $25, %hi(func)
write32<E>(Buf + 4, 0x08000000 | (S >> 2)); // j func
write32<E>(Buf + 8, 0x27390000); // addiu $25, $25, %lo(func)
write32<E>(Buf + 12, 0x00000000); // nop
writeMipsHi16<E>(Buf, S);
write32<E>(Buf + 4, 0x08000000 | (S >> 2));
writeMipsLo16<E>(Buf + 8, S);
}