diff --git a/src/codegen/llvm/codegen_amdgpu.cc b/src/codegen/llvm/codegen_amdgpu.cc index a1af9bd0656b..c49029520aa5 100644 --- a/src/codegen/llvm/codegen_amdgpu.cc +++ b/src/codegen/llvm/codegen_amdgpu.cc @@ -271,10 +271,14 @@ runtime::Module BuildAMDGPU(Array 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 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()); diff --git a/src/codegen/llvm/codegen_nvptx.cc b/src/codegen/llvm/codegen_nvptx.cc index c343de147cf6..20e160aebdb6 100644 --- a/src/codegen/llvm/codegen_nvptx.cc +++ b/src/codegen/llvm/codegen_nvptx.cc @@ -240,10 +240,14 @@ runtime::Module BuildNVPTX(Array 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()); diff --git a/src/codegen/llvm/llvm_module.cc b/src/codegen/llvm/llvm_module.cc index b8a38f595985..580dd0403b33 100644 --- a/src/codegen/llvm/llvm_module.cc +++ b/src/codegen/llvm/llvm_module.cc @@ -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();