support LLVM trunk after r202168 r202190 revisions
This commit is contained in:
12
builtins.cpp
12
builtins.cpp
@@ -758,6 +758,17 @@ AddBitcodeToModule(const unsigned char *bitcode, int length,
|
|||||||
// architecture and investigate what happened.
|
// architecture and investigate what happened.
|
||||||
// Generally we allow library DataLayout to be subset of module
|
// Generally we allow library DataLayout to be subset of module
|
||||||
// DataLayout or library DataLayout to be empty.
|
// DataLayout or library DataLayout to be empty.
|
||||||
|
#if defined(LLVM_3_5)
|
||||||
|
if (!VerifyDataLayoutCompatibility(module->getDataLayoutStr(),
|
||||||
|
bcModule->getDataLayoutStr())) {
|
||||||
|
Warning(SourcePos(), "Module DataLayout is incompatible with "
|
||||||
|
"library DataLayout:\n"
|
||||||
|
"Module DL: %s\n"
|
||||||
|
"Library DL: %s\n",
|
||||||
|
module->getDataLayoutStr().c_str(),
|
||||||
|
bcModule->getDataLayoutStr().c_str());
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (!VerifyDataLayoutCompatibility(module->getDataLayout(),
|
if (!VerifyDataLayoutCompatibility(module->getDataLayout(),
|
||||||
bcModule->getDataLayout())) {
|
bcModule->getDataLayout())) {
|
||||||
Warning(SourcePos(), "Module DataLayout is incompatible with "
|
Warning(SourcePos(), "Module DataLayout is incompatible with "
|
||||||
@@ -767,6 +778,7 @@ AddBitcodeToModule(const unsigned char *bitcode, int length,
|
|||||||
module->getDataLayout().c_str(),
|
module->getDataLayout().c_str(),
|
||||||
bcModule->getDataLayout().c_str());
|
bcModule->getDataLayout().c_str());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bcModule->setTargetTriple(mTriple.str());
|
bcModule->setTargetTriple(mTriple.str());
|
||||||
|
|||||||
@@ -1098,8 +1098,8 @@ Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine,
|
|||||||
}
|
}
|
||||||
|
|
||||||
llvm::PassManager pm;
|
llvm::PassManager pm;
|
||||||
#if defined(LLVM_3_1)
|
#if defined(LLVM_3_5)
|
||||||
pm.add(new llvm::TargetData(*g->target->getDataLayout()));
|
pm.add(new llvm::DataLayoutPass(*g->target->getDataLayout()));
|
||||||
#else
|
#else
|
||||||
pm.add(new llvm::DataLayout(*g->target->getDataLayout()));
|
pm.add(new llvm::DataLayout(*g->target->getDataLayout()));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
12
opt.cpp
12
opt.cpp
@@ -473,19 +473,19 @@ Optimize(llvm::Module *module, int optLevel) {
|
|||||||
new llvm::TargetLibraryInfo(llvm::Triple(module->getTargetTriple()));
|
new llvm::TargetLibraryInfo(llvm::Triple(module->getTargetTriple()));
|
||||||
optPM.add(targetLibraryInfo);
|
optPM.add(targetLibraryInfo);
|
||||||
|
|
||||||
|
#if defined(LLVM_3_5)
|
||||||
#if defined(LLVM_3_1)
|
optPM.add(new llvm::DataLayoutPass(*g->target->getDataLayout()));
|
||||||
optPM.add(new llvm::TargetData(*g->target->getDataLayout()));
|
|
||||||
#else
|
#else
|
||||||
optPM.add(new llvm::DataLayout(*g->target->getDataLayout()));
|
optPM.add(new llvm::DataLayout(*g->target->getDataLayout()));
|
||||||
|
#endif
|
||||||
|
|
||||||
llvm::TargetMachine *targetMachine = g->target->GetTargetMachine();
|
llvm::TargetMachine *targetMachine = g->target->GetTargetMachine();
|
||||||
#ifdef LLVM_3_2
|
|
||||||
|
#ifdef LLVM_3_2
|
||||||
optPM.add(new llvm::TargetTransformInfo(targetMachine->getScalarTargetTransformInfo(),
|
optPM.add(new llvm::TargetTransformInfo(targetMachine->getScalarTargetTransformInfo(),
|
||||||
targetMachine->getVectorTargetTransformInfo()));
|
targetMachine->getVectorTargetTransformInfo()));
|
||||||
#else // LLVM 3.3+
|
#else // LLVM 3.3+
|
||||||
targetMachine->addAnalysisPasses(optPM.getPM());
|
targetMachine->addAnalysisPasses(optPM.getPM());
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
optPM.add(llvm::createIndVarSimplifyPass());
|
optPM.add(llvm::createIndVarSimplifyPass());
|
||||||
|
|||||||
Reference in New Issue
Block a user