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

Brandon Bergren via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 20 12:38:06 PDT 2020


Bdragon28 added inline comments.


================
Comment at: lld/ELF/Arch/PPC64.cpp:165
+    uint32_t insn = 0xe9c1ff70 + 0x200008 * (r-14);
+    if (r == 29) {
+      write32(buf++, 0xe8010010); // ld 0, 16(1)
----------------
The example in the ABI doc was illustrating that you can split it into multiple chunks if you make sure both sides finish off saving the rest of the registers. It's actually cleaner to just have it continue dropping through until the end.

I believe the reason for the ABI doc having the example like it is is probably something to do with r30,r31 save/restore being much more common than full save/restore so binutils ld has a small and a large version.

Since we're not bothering with sticking multiple copies in anyway, it doesn't matter and we can go with the simpler implementation here of not treating r29 differently.


================
Comment at: lld/ELF/Arch/PPC64.cpp:179
+  }
+  write32(restgpr0 + 24, mtlr_0);
+  write32(restgpr0 + 25, blr);
----------------
These are at fixed offsets to catch counting errors in the code above, correct?


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