Commit da9a0330 by masahi Committed by Zhi

fix build with llvm trunk (#4386)

parent eca26032
...@@ -271,10 +271,14 @@ runtime::Module BuildAMDGPU(Array<LoweredFunc> funcs, std::string target) { ...@@ -271,10 +271,14 @@ runtime::Module BuildAMDGPU(Array<LoweredFunc> funcs, std::string target) {
CHECK(tm->addPassesToEmitFile( CHECK(tm->addPassesToEmitFile(
pass, destObj, llvm::TargetMachine::CGFT_ObjectFile) == 0) pass, destObj, llvm::TargetMachine::CGFT_ObjectFile) == 0)
<< "Cannot emit target CGFT_ObjectFile"; << "Cannot emit target CGFT_ObjectFile";
#else #elif TVM_LLVM_VERSION <= 90
CHECK(tm->addPassesToEmitFile( CHECK(tm->addPassesToEmitFile(
pass, destObj, nullptr, llvm::TargetMachine::CGFT_ObjectFile) == 0) pass, destObj, nullptr, llvm::TargetMachine::CGFT_ObjectFile) == 0)
<< "Cannot emit target CGFT_ObjectFile"; << "Cannot emit target CGFT_ObjectFile";
#else
CHECK(tm->addPassesToEmitFile(
pass, destObj, nullptr, llvm::CGFT_ObjectFile) == 0)
<< "Cannot emit target CGFT_ObjectFile";
#endif #endif
pass.run(*mObj); pass.run(*mObj);
std::string obj(dataObj.begin(), dataObj.end()); std::string obj(dataObj.begin(), dataObj.end());
...@@ -284,10 +288,14 @@ runtime::Module BuildAMDGPU(Array<LoweredFunc> funcs, std::string target) { ...@@ -284,10 +288,14 @@ runtime::Module BuildAMDGPU(Array<LoweredFunc> funcs, std::string target) {
CHECK(tm->addPassesToEmitFile(passAsm, destAsm, CHECK(tm->addPassesToEmitFile(passAsm, destAsm,
llvm::TargetMachine::CGFT_AssemblyFile) == 0) llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile"; << "Cannot emit target CGFT_AssemblyFile";
#else #elif TVM_LLVM_VERSION <= 90
CHECK(tm->addPassesToEmitFile(passAsm, destAsm, nullptr, CHECK(tm->addPassesToEmitFile(passAsm, destAsm, nullptr,
llvm::TargetMachine::CGFT_AssemblyFile) == 0) llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile"; << "Cannot emit target CGFT_AssemblyFile";
#else
CHECK(tm->addPassesToEmitFile(passAsm, destAsm, nullptr,
llvm::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile";
#endif #endif
passAsm.run(*mAsm); passAsm.run(*mAsm);
std::string assembly(dataAsm.begin(), dataAsm.end()); std::string assembly(dataAsm.begin(), dataAsm.end());
......
...@@ -240,10 +240,14 @@ runtime::Module BuildNVPTX(Array<LoweredFunc> funcs, std::string target) { ...@@ -240,10 +240,14 @@ runtime::Module BuildNVPTX(Array<LoweredFunc> funcs, std::string target) {
CHECK(tm->addPassesToEmitFile( CHECK(tm->addPassesToEmitFile(
pass, dest_ptx, llvm::TargetMachine::CGFT_AssemblyFile) == 0) pass, dest_ptx, llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_ObjectFile"; << "Cannot emit target CGFT_ObjectFile";
#else #elif TVM_LLVM_VERSION <= 90
CHECK(tm->addPassesToEmitFile( CHECK(tm->addPassesToEmitFile(
pass, dest_ptx, nullptr, llvm::TargetMachine::CGFT_AssemblyFile) == 0) pass, dest_ptx, nullptr, llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_ObjectFile"; << "Cannot emit target CGFT_ObjectFile";
#else
CHECK(tm->addPassesToEmitFile(
pass, dest_ptx, nullptr, llvm::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_ObjectFile";
#endif #endif
pass.run(*module); pass.run(*module);
std::string ptx(data_ptx.begin(), data_ptx.end()); std::string ptx(data_ptx.begin(), data_ptx.end());
......
...@@ -91,10 +91,14 @@ class LLVMModuleNode final : public runtime::ModuleNode { ...@@ -91,10 +91,14 @@ class LLVMModuleNode final : public runtime::ModuleNode {
CHECK(tm_->addPassesToEmitFile( CHECK(tm_->addPassesToEmitFile(
pass, dest, llvm::TargetMachine::CGFT_ObjectFile) == 0) pass, dest, llvm::TargetMachine::CGFT_ObjectFile) == 0)
<< "Cannot emit target CGFT_ObjectFile"; << "Cannot emit target CGFT_ObjectFile";
#else #elif TVM_LLVM_VERSION <= 90
CHECK(tm_->addPassesToEmitFile( CHECK(tm_->addPassesToEmitFile(
pass, dest, nullptr, llvm::TargetMachine::CGFT_ObjectFile) == 0) pass, dest, nullptr, llvm::TargetMachine::CGFT_ObjectFile) == 0)
<< "Cannot emit target CGFT_ObjectFile"; << "Cannot emit target CGFT_ObjectFile";
#else
CHECK(tm_->addPassesToEmitFile(
pass, dest, nullptr, llvm::CGFT_ObjectFile) == 0)
<< "Cannot emit target CGFT_ObjectFile";
#endif #endif
pass.run(*m); pass.run(*m);
} else if (fmt == "s" || fmt == "asm") { } else if (fmt == "s" || fmt == "asm") {
...@@ -109,10 +113,14 @@ class LLVMModuleNode final : public runtime::ModuleNode { ...@@ -109,10 +113,14 @@ class LLVMModuleNode final : public runtime::ModuleNode {
CHECK(tm_->addPassesToEmitFile( CHECK(tm_->addPassesToEmitFile(
pass, dest, llvm::TargetMachine::CGFT_AssemblyFile) == 0) pass, dest, llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile"; << "Cannot emit target CGFT_AssemblyFile";
#else #elif TVM_LLVM_VERSION <= 90
CHECK(tm_->addPassesToEmitFile( CHECK(tm_->addPassesToEmitFile(
pass, dest, nullptr, llvm::TargetMachine::CGFT_AssemblyFile) == 0) pass, dest, nullptr, llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile"; << "Cannot emit target CGFT_AssemblyFile";
#else
CHECK(tm_->addPassesToEmitFile(
pass, dest, nullptr, llvm::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile";
#endif #endif
pass.run(*m); pass.run(*m);
} else if (fmt == "ll") { } else if (fmt == "ll") {
...@@ -152,10 +160,14 @@ class LLVMModuleNode final : public runtime::ModuleNode { ...@@ -152,10 +160,14 @@ class LLVMModuleNode final : public runtime::ModuleNode {
CHECK(tm_->addPassesToEmitFile( CHECK(tm_->addPassesToEmitFile(
pass, rso, llvm::TargetMachine::CGFT_AssemblyFile) == 0) pass, rso, llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile"; << "Cannot emit target CGFT_AssemblyFile";
#else #elif TVM_LLVM_VERSION <= 90
CHECK(tm_->addPassesToEmitFile( CHECK(tm_->addPassesToEmitFile(
pass, rso, nullptr, llvm::TargetMachine::CGFT_AssemblyFile) == 0) pass, rso, nullptr, llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile"; << "Cannot emit target CGFT_AssemblyFile";
#else
CHECK(tm_->addPassesToEmitFile(
pass, rso, nullptr, llvm::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile";
#endif #endif
pass.run(*m); pass.run(*m);
return rso.str().str(); return rso.str().str();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment