Mousius commented on code in PR #13522:
URL: https://github.com/apache/tvm/pull/13522#discussion_r1036134224
##########
src/target/source/codegen_c_host.cc:
##########
@@ -93,18 +94,46 @@ void CodeGenCHost::AddFunction(const PrimFunc& f) {
}
}
-void CodeGenCHost::PrintFuncPrefix() { // NOLINT(*)
- stream << "#ifdef __cplusplus\n"
- << "extern \"C\"\n"
- << "#endif\n"
- << "TVM_DLL int32_t";
+void CodeGenCHost::GenerateForwardFunctionDeclarations(String global_symbol,
+ const Array<PrimExpr>&
args) {
+ for (auto& func_already_defined : GetFunctionNames()) {
+ if (global_symbol == func_already_defined) {
+ return;
+ }
+ }
+ this->PrintFuncPrefix(fwd_decl_stream);
+ fwd_decl_stream << " " << global_symbol << "(";
+ for (size_t i = 1; i < args.size(); ++i) {
Review Comment:
Would it make sense to have a `PrintFunctionPrototype`?
It seems there's more logic here:
https://github.com/apache/tvm/blob/a70c0649a895cf600e600bb3a1f49f6269aa71db/src/target/source/codegen_c.cc#L92-L119
which could apply?
--
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]