1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Redirect DataLayout from TargetMachine to Module in SjLjEHPrepare

Summary:
This change is part of a series of commits dedicated to have a single
DataLayout during compilation by using always the one owned by the
module.

Reviewers: echristo

Subscribers: yaron.keren, rafael, llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 241654
This commit is contained in:
Mehdi Amini 2015-07-08 01:00:31 +00:00
parent 0138358834
commit 1c1c1e62a3
3 changed files with 6 additions and 10 deletions

View File

@ -605,7 +605,7 @@ namespace llvm {
/// createSjLjEHPreparePass - This pass adapts exception handling code to use /// createSjLjEHPreparePass - This pass adapts exception handling code to use
/// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow. /// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow.
/// ///
FunctionPass *createSjLjEHPreparePass(const TargetMachine *TM); FunctionPass *createSjLjEHPreparePass();
/// LocalStackSlotAllocation - This pass assigns local frame indices to stack /// LocalStackSlotAllocation - This pass assigns local frame indices to stack
/// slots relative to one another and allocates base registers to access them /// slots relative to one another and allocates base registers to access them

View File

@ -424,7 +424,7 @@ void TargetPassConfig::addPassesToHandleExceptions() {
// removed from the parent invoke(s). This could happen when a landing // removed from the parent invoke(s). This could happen when a landing
// pad is shared by multiple invokes and is also a target of a normal // pad is shared by multiple invokes and is also a target of a normal
// edge from elsewhere. // edge from elsewhere.
addPass(createSjLjEHPreparePass(TM)); addPass(createSjLjEHPreparePass());
// FALLTHROUGH // FALLTHROUGH
case ExceptionHandling::DwarfCFI: case ExceptionHandling::DwarfCFI:
case ExceptionHandling::ARM: case ExceptionHandling::ARM:

View File

@ -45,7 +45,6 @@ STATISTIC(NumSpilled, "Number of registers live across unwind edges");
namespace { namespace {
class SjLjEHPrepare : public FunctionPass { class SjLjEHPrepare : public FunctionPass {
const TargetMachine *TM;
Type *doubleUnderDataTy; Type *doubleUnderDataTy;
Type *doubleUnderJBufTy; Type *doubleUnderJBufTy;
Type *FunctionContextTy; Type *FunctionContextTy;
@ -63,7 +62,7 @@ class SjLjEHPrepare : public FunctionPass {
public: public:
static char ID; // Pass identification, replacement for typeid static char ID; // Pass identification, replacement for typeid
explicit SjLjEHPrepare(const TargetMachine *TM) : FunctionPass(ID), TM(TM) {} explicit SjLjEHPrepare() : FunctionPass(ID) {}
bool doInitialization(Module &M) override; bool doInitialization(Module &M) override;
bool runOnFunction(Function &F) override; bool runOnFunction(Function &F) override;
@ -85,9 +84,7 @@ private:
char SjLjEHPrepare::ID = 0; char SjLjEHPrepare::ID = 0;
// Public Interface To the SjLjEHPrepare pass. // Public Interface To the SjLjEHPrepare pass.
FunctionPass *llvm::createSjLjEHPreparePass(const TargetMachine *TM) { FunctionPass *llvm::createSjLjEHPreparePass() { return new SjLjEHPrepare(); }
return new SjLjEHPrepare(TM);
}
// doInitialization - Set up decalarations and types needed to process // doInitialization - Set up decalarations and types needed to process
// exceptions. // exceptions.
bool SjLjEHPrepare::doInitialization(Module &M) { bool SjLjEHPrepare::doInitialization(Module &M) {
@ -196,9 +193,8 @@ Value *SjLjEHPrepare::setupFunctionContext(Function &F,
// Create an alloca for the incoming jump buffer ptr and the new jump buffer // Create an alloca for the incoming jump buffer ptr and the new jump buffer
// that needs to be restored on all exits from the function. This is an alloca // that needs to be restored on all exits from the function. This is an alloca
// because the value needs to be added to the global context list. // because the value needs to be added to the global context list.
const TargetLowering *TLI = TM->getSubtargetImpl(F)->getTargetLowering(); auto &DL = F.getParent()->getDataLayout();
unsigned Align = unsigned Align = DL.getPrefTypeAlignment(FunctionContextTy);
TLI->getDataLayout()->getPrefTypeAlignment(FunctionContextTy);
FuncCtx = new AllocaInst(FunctionContextTy, nullptr, Align, "fn_context", FuncCtx = new AllocaInst(FunctionContextTy, nullptr, Align, "fn_context",
EntryBB->begin()); EntryBB->begin());