1
Fork 0

Add new_regular and new_allocator to ModuleCodegen

This commit is contained in:
DianQK 2025-02-06 21:59:36 +08:00
parent f32ca1afaf
commit 9431427cc3
No known key found for this signature in database
6 changed files with 23 additions and 28 deletions

View file

@ -686,7 +686,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
submit_codegened_module_to_llvm(
&backend,
&ongoing_codegen.coordinator.sender,
ModuleCodegen { name: llmod_id, module_llvm, kind: ModuleKind::Allocator },
ModuleCodegen::new_allocator(llmod_id, module_llvm),
cost,
);
}

View file

@ -78,6 +78,14 @@ pub struct ModuleCodegen<M> {
}
impl<M> ModuleCodegen<M> {
pub fn new_regular(name: impl Into<String>, module: M) -> Self {
Self { name: name.into(), module_llvm: module, kind: ModuleKind::Regular }
}
pub fn new_allocator(name: impl Into<String>, module: M) -> Self {
Self { name: name.into(), module_llvm: module, kind: ModuleKind::Allocator }
}
pub fn into_compiled_module(
self,
emit_obj: bool,