[PATCH] D87916: [PowerPC][LLD] Extend R2 save stub to support offsets of more than 26 bits
Stefan Pintilie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 18 09:23:01 PDT 2020
stefanp created this revision.
stefanp added reviewers: nemanjai, MaskRay.
Herald added subscribers: shchenz, kbarton, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
stefanp requested review of this revision.
The R2 <https://reviews.llvm.org/source/clang-tools-extra/> save stub will now support offsets up to 64 bits.
There are three cases that will be used.
1. The offset fits in 26 bits.
b <26 bit offset>
2. The offset does not fit in 26 bits but fits in 34 bits.
paddi r12, 0, <34 bit offset>, 1
mtctr r12
bctr
3. The offset does not fit in 34 bits. Since this is an R2 <https://reviews.llvm.org/source/clang-tools-extra/> save stub we can use
the TOC in R2 <https://reviews.llvm.org/source/clang-tools-extra/>. We are not loading the offset but the actual address we want to
branch to.
addis r12, r2, <address in TOC lo>
ld r12 <address in TOC hi>(r12)
mtctr r12
bctr
In case 1) the stub is only 8 bytes while in cases 2) and 3) the stub will be
20 bytes.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87916
Files:
lld/ELF/Thunks.cpp
lld/test/ELF/ppc64-toc-call-to-pcrel-long-jump.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87916.292826.patch
Type: text/x-patch
Size: 6614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200918/b3b17296/attachment.bin>
More information about the llvm-commits
mailing list