mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 09:00:33 +03:00
LLVM 3.7: DataLayoutPass is gone.
DataLayout is now non-optional at the module. Therefore there is no need for a separate DataLayoutPass.
This commit is contained in:
parent
192583d336
commit
66bf03b96b
3 changed files with 23 additions and 4 deletions
|
@ -356,7 +356,12 @@ bool ldc_optimize_module(llvm::Module *M)
|
|||
#endif
|
||||
|
||||
// Add an appropriate DataLayout instance for this module.
|
||||
#if LDC_LLVM_VER >= 306
|
||||
#if LDC_LLVM_VER >= 307
|
||||
// The DataLayout is already set at the module (in module.cpp,
|
||||
// method Module::genLLVMModule())
|
||||
// FIXME: Introduce new command line switch default-data-layout to
|
||||
// override the module data layout
|
||||
#elif LDC_LLVM_VER == 306
|
||||
mpm.add(new DataLayoutPass());
|
||||
#elif LDC_LLVM_VER == 305
|
||||
const DataLayout *DL = M->getDataLayout();
|
||||
|
|
|
@ -416,7 +416,9 @@ namespace {
|
|||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
#if LDC_LLVM_VER >= 305
|
||||
#if LDC_LLVM_VER < 307
|
||||
AU.addRequired<DataLayoutPass>();
|
||||
#endif
|
||||
AU.addRequired<DominatorTreeWrapperPass>();
|
||||
AU.addPreserved<CallGraphWrapperPass>();
|
||||
#else
|
||||
|
@ -480,7 +482,12 @@ static bool isSafeToStackAllocate(Instruction* Alloc, Value* V, DominatorTree& D
|
|||
bool GarbageCollect2Stack::runOnFunction(Function &F) {
|
||||
DEBUG(errs() << "\nRunning -dgc2stack on function " << F.getName() << '\n');
|
||||
|
||||
#if LDC_LLVM_VER >= 305
|
||||
#if LDC_LLVM_VER >= 307
|
||||
const DataLayout &DL = F.getParent()->getDataLayout();
|
||||
DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
|
||||
CallGraphWrapperPass *CGPass = getAnalysisIfAvailable<CallGraphWrapperPass>();
|
||||
CallGraph *CG = CGPass ? &CGPass->getCallGraph() : 0;
|
||||
#elif LDC_LLVM_VER >= 305
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
assert(DLP && "required DataLayoutPass is null");
|
||||
const DataLayout &DL = DLP->getDataLayout();
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
#include "Passes.h"
|
||||
#include "llvm/Pass.h"
|
||||
#if LDC_LLVM_VER >= 307
|
||||
#include "llvm/IR/Module.h"
|
||||
#endif
|
||||
#if LDC_LLVM_VER >= 303
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
|
@ -303,7 +306,9 @@ namespace {
|
|||
bool runOnce(Function &F, const DataLayout *DL, AliasAnalysis& AA);
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
#if LDC_LLVM_VER >= 305
|
||||
#if LDC_LLVM_VER >= 307
|
||||
// The DataLayoutPass is removed.
|
||||
#elif LDC_LLVM_VER >= 305
|
||||
AU.addRequired<DataLayoutPass>();
|
||||
#else
|
||||
AU.addRequired<DataLayout>();
|
||||
|
@ -357,7 +362,9 @@ bool SimplifyDRuntimeCalls::runOnFunction(Function &F) {
|
|||
if (Optimizations.empty())
|
||||
InitOptimizations();
|
||||
|
||||
#if LDC_LLVM_VER >= 305
|
||||
#if LDC_LLVM_VER >= 307
|
||||
const DataLayout *DL = &F.getParent()->getDataLayout();
|
||||
#elif LDC_LLVM_VER >= 305
|
||||
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
|
||||
const DataLayout *DL = DLP ? &DLP->getDataLayout() : 0;
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue