HomePhabricator

[PowerPC] Fix large code model with the ELFv2 ABI

Authored by uweigand on Jan 13 2016, 5:12 AM.

Description

[PowerPC] Fix large code model with the ELFv2 ABI

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

Reviewers: hfinkel

Differential Revision: http://reviews.llvm.org/D15500

llvm-svn: 257597

Details

Committed
uweigandJan 13 2016, 5:12 AM
Differential Revision
D15500: [PowerPC] Fix large code model with the ELFv2 ABI
Parents
rG3d737e45c0bd: Reapply r257588 Fix: Added missed input file.
Branches
Unknown
Tags
Unknown