pub fn build_module(
module: impl IntoArg<IRModule>,
target: impl IntoArg<Target>,
) -> Result<Module>Expand description
Compile module into a runtime module with the code generator of the kind of target
(codegen.Build).
§Errors
Returns an error if the code generator of the kind is not built in or loaded, or the error it raises.
§Examples
use tvm_tirx::codegen;
use tvm_tirx::ir::{DictAttrs, GlobalVar, IRModule, PrimVar, UNKNOWN_LOC};
use tvm_tirx::target::Target;
use tvm_tirx::tvm_ffi::Map;
let functions = Map::from_iter([(GlobalVar::new("add_one", UNKNOWN_LOC), add_one.into())]);
let module = IRModule::new(&functions, DictAttrs::new(Map::new()), Map::new())?;
let compiled = codegen::build_module(&module, Target::new("c")?)?;
assert!(compiled.implements_function_with_imports("add_one")?);