mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-11 05:35:11 +00:00
dc8dfe1b86
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257597 91177308-0d34-0410-b5e6-96231b3b80d8
47 lines
1.8 KiB
C++
47 lines
1.8 KiB
C++
//===-- PPCMachineFunctionInfo.cpp - Private data used for PowerPC --------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "PPCMachineFunctionInfo.h"
|
|
#include "llvm/IR/DataLayout.h"
|
|
#include "llvm/MC/MCContext.h"
|
|
#include "llvm/Target/TargetMachine.h"
|
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
|
|
|
using namespace llvm;
|
|
|
|
void PPCFunctionInfo::anchor() { }
|
|
|
|
MCSymbol *PPCFunctionInfo::getPICOffsetSymbol() const {
|
|
const DataLayout &DL = MF.getDataLayout();
|
|
return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
|
|
Twine(MF.getFunctionNumber()) +
|
|
"$poff");
|
|
}
|
|
|
|
MCSymbol *PPCFunctionInfo::getGlobalEPSymbol() const {
|
|
const DataLayout &DL = MF.getDataLayout();
|
|
return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
|
|
"func_gep" +
|
|
Twine(MF.getFunctionNumber()));
|
|
}
|
|
|
|
MCSymbol *PPCFunctionInfo::getLocalEPSymbol() const {
|
|
const DataLayout &DL = MF.getDataLayout();
|
|
return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
|
|
"func_lep" +
|
|
Twine(MF.getFunctionNumber()));
|
|
}
|
|
|
|
MCSymbol *PPCFunctionInfo::getTOCOffsetSymbol() const {
|
|
const DataLayout &DL = MF.getDataLayout();
|
|
return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
|
|
"func_toc" +
|
|
Twine(MF.getFunctionNumber()));
|
|
}
|