[PATCH] D79977: [ELF][PPC64] Synthesize _savegpr[01]_{14..31} and _restgpr[01]_{14..31}

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 21 09:41:47 PDT 2020


sfertile added a comment.

Thanks for implementing this MaskRay. I've left a couple comments, but still need to go through the testing.



================
Comment at: lld/ELF/Arch/PPC64.cpp:133
+void elf::addPPC64SaveRestore() {
+  static uint32_t savegpr0[20], restgpr0[21], savegpr1[19], restgpr1[19];
+  constexpr uint32_t blr = 0x4e800020, mtlr_0 = 0x7c0803a6;
----------------
Since we are always writing the entire routine into the buffer anyway why not just hard code the array contents so we don't have to compute it at runtime?


================
Comment at: lld/ELF/Arch/PPC64.cpp:143
+  auto addSection = [&](uint32_t *begin, uint32_t *end) {
+    if (defined.empty())
+      return;
----------------
real minor nit: I think the code would be a bit clearer if this check cake outside the lamda: eg

```
if (!defined.empty())
  addSection(...)
```


================
Comment at: lld/ELF/Arch/PPC64.cpp:152
+      sym->section = sec;
+      sym->value -= 4 * (first - begin);
+    }
----------------
Does it clutter the code too much to keep track of the correct value in the loop that calls `addOptional' and not have to adjust this later?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79977/new/

https://reviews.llvm.org/D79977





More information about the llvm-commits mailing list