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) {
CHECK(tm->addPassesToEmitFile(
pass, destObj, llvm::TargetMachine::CGFT_ObjectFile) == 0)
<< "Cannot emit target CGFT_ObjectFile";
#else
#elif TVM_LLVM_VERSION <= 90
CHECK(tm->addPassesToEmitFile(
pass, destObj, nullptr, llvm::TargetMachine::CGFT_ObjectFile) == 0)
<< "Cannot emit target CGFT_ObjectFile";
#else
CHECK(tm->addPassesToEmitFile(
pass, destObj, nullptr, llvm::CGFT_ObjectFile) == 0)
<< "Cannot emit target CGFT_ObjectFile";
#endif
pass.run(*mObj);
std::string obj(dataObj.begin(), dataObj.end());
......@@ -284,10 +288,14 @@ runtime::Module BuildAMDGPU(Array<LoweredFunc> funcs, std::string target) {
CHECK(tm->addPassesToEmitFile(passAsm, destAsm,
llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile";
#else
#elif TVM_LLVM_VERSION <= 90
CHECK(tm->addPassesToEmitFile(passAsm, destAsm, nullptr,
llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile";
#else
CHECK(tm->addPassesToEmitFile(passAsm, destAsm, nullptr,
llvm::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile";
#endif
passAsm.run(*mAsm);
std::string assembly(dataAsm.begin(), dataAsm.end());
......
......@@ -240,10 +240,14 @@ runtime::Module BuildNVPTX(Array<LoweredFunc> funcs, std::string target) {
CHECK(tm->addPassesToEmitFile(
pass, dest_ptx, llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_ObjectFile";
#else
#elif TVM_LLVM_VERSION <= 90
CHECK(tm->addPassesToEmitFile(
pass, dest_ptx, nullptr, llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_ObjectFile";
#else
CHECK(tm->addPassesToEmitFile(
pass, dest_ptx, nullptr, llvm::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_ObjectFile";
#endif
pass.run(*module);
std::string ptx(data_ptx.begin(), data_ptx.end());
......
......@@ -91,10 +91,14 @@ class LLVMModuleNode final : public runtime::ModuleNode {
CHECK(tm_->addPassesToEmitFile(
pass, dest, llvm::TargetMachine::CGFT_ObjectFile) == 0)
<< "Cannot emit target CGFT_ObjectFile";
#else
#elif TVM_LLVM_VERSION <= 90
CHECK(tm_->addPassesToEmitFile(
pass, dest, nullptr, llvm::TargetMachine::CGFT_ObjectFile) == 0)
<< "Cannot emit target CGFT_ObjectFile";
#else
CHECK(tm_->addPassesToEmitFile(
pass, dest, nullptr, llvm::CGFT_ObjectFile) == 0)
<< "Cannot emit target CGFT_ObjectFile";
#endif
pass.run(*m);
} else if (fmt == "s" || fmt == "asm") {
......@@ -109,10 +113,14 @@ class LLVMModuleNode final : public runtime::ModuleNode {
CHECK(tm_->addPassesToEmitFile(
pass, dest, llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile";
#else
#elif TVM_LLVM_VERSION <= 90
CHECK(tm_->addPassesToEmitFile(
pass, dest, nullptr, llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile";
#else
CHECK(tm_->addPassesToEmitFile(
pass, dest, nullptr, llvm::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile";
#endif
pass.run(*m);
} else if (fmt == "ll") {
......@@ -152,10 +160,14 @@ class LLVMModuleNode final : public runtime::ModuleNode {
CHECK(tm_->addPassesToEmitFile(
pass, rso, llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile";
#else
#elif TVM_LLVM_VERSION <= 90
CHECK(tm_->addPassesToEmitFile(
pass, rso, nullptr, llvm::TargetMachine::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile";
#else
CHECK(tm_->addPassesToEmitFile(
pass, rso, nullptr, llvm::CGFT_AssemblyFile) == 0)
<< "Cannot emit target CGFT_AssemblyFile";
#endif
pass.run(*m);
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