Rename define_function to define_function_with_control_plane (#6165)
And add a define_function convenience function which uses a default control plane.
This commit is contained in:
@@ -51,10 +51,7 @@ fn main() {
|
||||
bcx.seal_all_blocks();
|
||||
bcx.finalize();
|
||||
}
|
||||
let ctrl_plane = &mut Default::default();
|
||||
module
|
||||
.define_function(func_a, &mut ctx, ctrl_plane)
|
||||
.unwrap();
|
||||
module.define_function(func_a, &mut ctx).unwrap();
|
||||
module.clear_context(&mut ctx);
|
||||
|
||||
ctx.func.signature = sig_b;
|
||||
@@ -77,9 +74,7 @@ fn main() {
|
||||
bcx.seal_all_blocks();
|
||||
bcx.finalize();
|
||||
}
|
||||
module
|
||||
.define_function(func_b, &mut ctx, ctrl_plane)
|
||||
.unwrap();
|
||||
module.define_function(func_b, &mut ctx).unwrap();
|
||||
module.clear_context(&mut ctx);
|
||||
|
||||
// Perform linking.
|
||||
|
||||
@@ -679,7 +679,7 @@ impl Module for JITModule {
|
||||
})
|
||||
}
|
||||
|
||||
fn define_function(
|
||||
fn define_function_with_control_plane(
|
||||
&mut self,
|
||||
id: FuncId,
|
||||
ctx: &mut cranelift_codegen::Context,
|
||||
|
||||
@@ -57,9 +57,7 @@ fn define_simple_function(module: &mut JITModule) -> FuncId {
|
||||
bcx.ins().return_(&[]);
|
||||
}
|
||||
|
||||
module
|
||||
.define_function(func_id, &mut ctx, &mut Default::default())
|
||||
.unwrap();
|
||||
module.define_function(func_id, &mut ctx).unwrap();
|
||||
|
||||
func_id
|
||||
}
|
||||
@@ -210,7 +208,7 @@ fn libcall_function() {
|
||||
}
|
||||
|
||||
module
|
||||
.define_function(func_id, &mut ctx, &mut Default::default())
|
||||
.define_function_with_control_plane(func_id, &mut ctx, &mut Default::default())
|
||||
.unwrap();
|
||||
|
||||
module.finalize_definitions().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user