Lunderberg commented on a change in pull request #10710:
URL: https://github.com/apache/tvm/pull/10710#discussion_r833352455
##########
File path: src/target/llvm/codegen_hexagon.cc
##########
@@ -572,6 +574,43 @@ llvm::Value* CodeGenHexagon::CreateIntrinsic(const
CallNode* op) {
return CodeGenLLVM::CreateIntrinsic(op);
}
+void CodeGenHexagon::CreatePrintf(const std::string& format,
+ const std::vector<llvm::Value*> format_args)
{
+ // This function generates LLVM instructions to call HAP_debug_v2,
+ // as if the FARF macro in `HAP_farf.h` were called as
+ // FARF(ALWAYS, format, format_args[0], format_args[1], ...)
+ std::string func_name = "HAP_debug_v2";
+
+ llvm::Function* func = module_->getFunction(func_name);
+ if (func == nullptr) {
+ llvm::FunctionType* ftype = llvm::FunctionType::get(
+ t_void_, {t_int32_, t_char_->getPointerTo(), t_int32_,
t_char_->getPointerTo()}, true);
+ func = llvm::Function::Create(ftype, llvm::Function::ExternalLinkage,
func_name, module_.get());
+ }
+
+ llvm::Value* format_str = builder_->CreateGlobalStringPtr(format + "\0");
Review comment:
Thank you, and updated for both suggestions.
--
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]