[PATCH] D15500: [PowerPC] Fix large code model with the ELFv2 ABI
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 14 09:35:40 PST 2015
uweigand created this revision.
uweigand added a reviewer: hfinkel.
uweigand added a subscriber: llvm-commits.
The global entry point prologue currently assumes that the TOC associated
with a function is less than 2GB away from the function entry point. This
is always true when using the medium or small code model, but may not be
the case when using the large code model.
This patch adds a new variant of the ELFv2 global entry point prologue that
lifts the 2GB restriction when building with -mcmodel=large. This works by
emitting a quadword containing the distance from the function entry point
to its associated TOC immediately before the entry point, and then using a
prologue like:
ld r2,-8(r12)
add r2,r2,r12
Since creation of the entry point prologue is now split across two separate
routines (PPCLinuxAsmPrinter::EmitFunctionEntryLabel emits the data word,
PPCLinuxAsmPrinter::EmitFunctionBodyStart the prolog code), I've switched
to using named labels instead of just temporaries to indicate the locations
of the global and local entry points and the new TOC offset data word.
These names are provided by new routines in PPCFunctionInfo modeled
after the existing PPCFunctionInfo::getPICOffsetSymbol.
Note that a corresponding change was committed to GCC here:
https://gcc.gnu.org/ml/gcc-patches/2015-12/msg00355.html
[ The GCC patch implements a further optimization, R_PPC64_ENTRY,
which isn't in the LLVM patch yet, since it requires working .reloc
support in the assembler. This can always be added later on. ]
http://reviews.llvm.org/D15500
Files:
lib/Target/PowerPC/PPCAsmPrinter.cpp
lib/Target/PowerPC/PPCMachineFunctionInfo.cpp
lib/Target/PowerPC/PPCMachineFunctionInfo.h
test/CodeGen/PowerPC/ppc64le-localentry-large.ll
test/CodeGen/PowerPC/ppc64le-localentry.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15500.42729.patch
Type: text/x-patch
Size: 10298 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151214/f3af5909/attachment.bin>
More information about the llvm-commits
mailing list