Merge branch 'merge-2.064' into merge-2.065

Conflicts:
	runtime/druntime
This commit is contained in:
kai 2014-03-12 18:27:43 +01:00
commit f8a53ab3dc
16 changed files with 187 additions and 46 deletions

View file

@ -60,7 +60,12 @@ static void codegenModule(llvm::TargetMachine &Target, llvm::Module& m,
// Build up all of the passes that we want to do to the module.
FunctionPassManager Passes(&m);
#if LDC_LLVM_VER >= 302
#if LDC_LLVM_VER >= 305
if (const DataLayout *DL = Target.getDataLayout())
Passes.add(new DataLayoutPass(*DL));
else
Passes.add(new DataLayoutPass(&m));
#elif LDC_LLVM_VER >= 302
if (const DataLayout *DL = Target.getDataLayout())
Passes.add(new DataLayout(*DL));
else
@ -136,7 +141,13 @@ void writeModule(llvm::Module* m, std::string filename)
llvm::sys::path::replace_extension(bcpath, global.bc_ext);
Logger::println("Writing LLVM bitcode to: %s\n", bcpath.c_str());
std::string errinfo;
llvm::raw_fd_ostream bos(bcpath.c_str(), errinfo, llvm::sys::fs::F_Binary);
llvm::raw_fd_ostream bos(bcpath.c_str(), errinfo,
#if LDC_LLVM_VER >= 305
llvm::sys::fs::F_None
#else
llvm::sys::fs::F_Binary
#endif
);
if (bos.has_error())
{
error(Loc(), "cannot write LLVM bitcode file '%s': %s", bcpath.c_str(), errinfo.c_str());
@ -151,7 +162,13 @@ void writeModule(llvm::Module* m, std::string filename)
llvm::sys::path::replace_extension(llpath, global.ll_ext);
Logger::println("Writing LLVM asm to: %s\n", llpath.c_str());
std::string errinfo;
llvm::raw_fd_ostream aos(llpath.c_str(), errinfo);
llvm::raw_fd_ostream aos(llpath.c_str(), errinfo,
#if LDC_LLVM_VER >= 305
llvm::sys::fs::F_None
#else
llvm::sys::fs::F_Binary
#endif
);
if (aos.has_error())
{
error(Loc(), "cannot write LLVM asm file '%s': %s", llpath.c_str(), errinfo.c_str());
@ -180,7 +197,13 @@ void writeModule(llvm::Module* m, std::string filename)
Logger::println("Writing native asm to: %s\n", spath.c_str());
std::string err;
{
llvm::raw_fd_ostream out(spath.c_str(), err);
llvm::raw_fd_ostream out(spath.c_str(), err,
#if LDC_LLVM_VER >= 305
llvm::sys::fs::F_None
#else
llvm::sys::fs::F_Binary
#endif
);
if (err.empty())
{
codegenModule(*gTargetMachine, *m, out, llvm::TargetMachine::CGFT_AssemblyFile);
@ -210,7 +233,13 @@ void writeModule(llvm::Module* m, std::string filename)
Logger::println("Writing object file to: %s\n", objpath.c_str());
std::string err;
{
llvm::raw_fd_ostream out(objpath.c_str(), err, llvm::sys::fs::F_Binary);
llvm::raw_fd_ostream out(objpath.c_str(), err,
#if LDC_LLVM_VER >= 305
llvm::sys::fs::F_None
#else
llvm::sys::fs::F_Binary
#endif
);
if (err.empty())
{
codegenModule(*gTargetMachine, *m, out, llvm::TargetMachine::CGFT_ObjectFile);