kparzysz-quic commented on code in PR #12140:
URL: https://github.com/apache/tvm/pull/12140#discussion_r928913008
##########
src/target/llvm/codegen_llvm.cc:
##########
@@ -121,38 +121,37 @@ std::unique_ptr<CodeGenLLVM>
CodeGenLLVM::Create(llvm::TargetMachine* tm) {
}
}
-void CodeGenLLVM::Init(const std::string& module_name, llvm::TargetMachine* tm,
- llvm::LLVMContext* ctx, bool system_lib, bool
dynamic_lookup,
- bool target_c_runtime) {
- InitializeLLVM();
- ctx_ = ctx;
- builder_.reset(new IRBuilder(*ctx_));
- module_.reset(new llvm::Module(module_name, *ctx_));
- md_builder_.reset(new llvm::MDBuilder(*ctx_));
+void CodeGenLLVM::Init(const std::string& module_name, LLVMTarget*
llvm_target, bool system_lib,
+ bool dynamic_lookup, bool target_c_runtime) {
+ llvm_target_ = llvm_target;
+ llvm::LLVMContext* ctx = llvm_target_->GetContext();
+ builder_.reset(new IRBuilder(*ctx));
+ module_.reset(new llvm::Module(module_name, *ctx));
+ md_builder_.reset(new llvm::MDBuilder(*ctx));
// types
- t_void_ = llvm::Type::getVoidTy(*ctx_);
- t_void_p_ =
llvm::Type::getInt8Ty(*ctx_)->getPointerTo(GetGlobalAddressSpace());
- t_int_ = llvm::Type::getInt32Ty(*ctx_);
- t_char_ = llvm::Type::getInt8Ty(*ctx_);
- t_int8_ = llvm::Type::getInt8Ty(*ctx_);
- t_int16_ = llvm::Type::getInt16Ty(*ctx_);
- t_int32_ = llvm::Type::getInt32Ty(*ctx_);
- t_int64_ = llvm::Type::getInt64Ty(*ctx_);
- t_float64_ = llvm::Type::getDoubleTy(*ctx_);
+ t_void_ = llvm::Type::getVoidTy(*ctx);
+ t_void_p_ =
llvm::Type::getInt8Ty(*ctx)->getPointerTo(GetGlobalAddressSpace());
+ t_int_ = llvm::Type::getInt32Ty(*ctx);
+ t_char_ = llvm::Type::getInt8Ty(*ctx);
+ t_int8_ = llvm::Type::getInt8Ty(*ctx);
+ t_int16_ = llvm::Type::getInt16Ty(*ctx);
+ t_int32_ = llvm::Type::getInt32Ty(*ctx);
+ t_int64_ = llvm::Type::getInt64Ty(*ctx);
+ t_float64_ = llvm::Type::getDoubleTy(*ctx);
// meta data
md_very_likely_branch_ = md_builder_->createBranchWeights(1 << 20, 1);
md_tbaa_root_ = md_builder_->createTBAARoot("tvm-tbaa");
md_tbaa_alias_set_ = md_builder_->createTBAANode("tvm-alias", md_tbaa_root_);
- this->InitTarget(tm);
+ InitTarget();
}
void CodeGenLLVM::SetFastMathFlag(llvm::FastMathFlags fmf) {
builder_->setFastMathFlags(fmf); }
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]