[PATCH] D52115: [PPC64] Add helpers for read/writing an instruction while relocating a half16 type. [NFC]

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 14 14:26:03 PDT 2018


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: ELF/Arch/PPC64.cpp:125
+static void writeInstrFromHalf16(uint8_t* Loc, uint32_t Instr) {
+  uint8_t *InstrStart = Loc - (Config->EKind == ELF64BEKind ? 2U : 0U);
+  write32(InstrStart, Instr);
----------------
I believe you can drop `U`.

`InstrStart` is perhaps a bit too long variable name for something whose scope is just two lines. I'd name just `L`.


================
Comment at: ELF/Arch/PPC64.cpp:130
+static uint32_t readInstrFromHalf16(const uint8_t* Loc) {
+  const uint8_t *InstrStart = Loc - (Config->EKind == ELF64BEKind ? 2U : 0U);
+  return read32(InstrStart);
----------------
Ditto.

Drop `const` because it's obviously a constant.


================
Comment at: ELF/Arch/PPC64.cpp:223
+    // 2 bytes on BE.
+    relocateOne(Loc + 4 + (Config->EKind == ELF64BEKind ? 2U : 0U),
+                R_PPC64_TPREL16_LO, Val);
----------------
Drop `U`.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D52115





More information about the llvm-commits mailing list