Struct cranelift_object::ObjectModule
source · [−]pub struct ObjectModule { /* private fields */ }Expand description
An ObjectModule implements Module and emits “.o” files using the object library.
See the ObjectBuilder for a convenient way to construct ObjectModule instances.
Implementations
sourceimpl ObjectModule
impl ObjectModule
sourcepub fn new(builder: ObjectBuilder) -> Self
pub fn new(builder: ObjectBuilder) -> Self
Create a new ObjectModule using the given Cranelift target.
sourceimpl ObjectModule
impl ObjectModule
sourcepub fn finish(self) -> ObjectProduct
pub fn finish(self) -> ObjectProduct
Finalize all relocations and output an object.
Trait Implementations
sourceimpl Module for ObjectModule
impl Module for ObjectModule
sourcefn declarations(&self) -> &ModuleDeclarations
fn declarations(&self) -> &ModuleDeclarations
Get all declarations in this module.
sourcefn declare_function(
&mut self,
name: &str,
linkage: Linkage,
signature: &Signature
) -> ModuleResult<FuncId>
fn declare_function(
&mut self,
name: &str,
linkage: Linkage,
signature: &Signature
) -> ModuleResult<FuncId>
Declare a function in this module.
sourcefn declare_anonymous_function(
&mut self,
signature: &Signature
) -> ModuleResult<FuncId>
fn declare_anonymous_function(
&mut self,
signature: &Signature
) -> ModuleResult<FuncId>
Declare an anonymous function in this module.
sourcefn declare_data(
&mut self,
name: &str,
linkage: Linkage,
writable: bool,
tls: bool
) -> ModuleResult<DataId>
fn declare_data(
&mut self,
name: &str,
linkage: Linkage,
writable: bool,
tls: bool
) -> ModuleResult<DataId>
Declare a data object in this module.
sourcefn declare_anonymous_data(
&mut self,
writable: bool,
tls: bool
) -> ModuleResult<DataId>
fn declare_anonymous_data(
&mut self,
writable: bool,
tls: bool
) -> ModuleResult<DataId>
Declare an anonymous data object in this module.
sourcefn define_function(
&mut self,
func_id: FuncId,
ctx: &mut Context,
trap_sink: &mut dyn TrapSink,
stack_map_sink: &mut dyn StackMapSink
) -> ModuleResult<ModuleCompiledFunction>
fn define_function(
&mut self,
func_id: FuncId,
ctx: &mut Context,
trap_sink: &mut dyn TrapSink,
stack_map_sink: &mut dyn StackMapSink
) -> ModuleResult<ModuleCompiledFunction>
Define a function, producing the function body from the given Context. Read more
sourcefn define_function_bytes(
&mut self,
func_id: FuncId,
bytes: &[u8],
relocs: &[RelocRecord]
) -> ModuleResult<ModuleCompiledFunction>
fn define_function_bytes(
&mut self,
func_id: FuncId,
bytes: &[u8],
relocs: &[RelocRecord]
) -> ModuleResult<ModuleCompiledFunction>
Define a function, taking the function body from the given bytes. Read more
sourcefn define_data(
&mut self,
data_id: DataId,
data_ctx: &DataContext
) -> ModuleResult<()>
fn define_data(
&mut self,
data_id: DataId,
data_ctx: &DataContext
) -> ModuleResult<()>
Define a data object, producing the data contents from the given DataContext.
sourcefn get_name(&self, name: &str) -> Option<FuncOrDataId>
fn get_name(&self, name: &str) -> Option<FuncOrDataId>
Get the module identifier for a given name, if that name has been declared. Read more
sourcefn target_config(&self) -> TargetFrontendConfig
fn target_config(&self) -> TargetFrontendConfig
Return the target information needed by frontends to produce Cranelift IR for the current target. Read more
sourcefn make_context(&self) -> Context
fn make_context(&self) -> Context
Create a new Context initialized for use with this Module. Read more
sourcefn clear_context(&self, ctx: &mut Context)
fn clear_context(&self, ctx: &mut Context)
Clear the given Context and reset it for use with a new function. Read more
sourcefn make_signature(&self) -> Signature
fn make_signature(&self) -> Signature
Create a new empty Signature with the default calling convention for
the TargetIsa, to which parameter and return types can be added for
declaring a function to be called by this Module. Read more
sourcefn clear_signature(&self, sig: &mut Signature)
fn clear_signature(&self, sig: &mut Signature)
Clear the given Signature and reset for use with a new function. Read more
sourcefn declare_func_in_func(&self, func: FuncId, in_func: &mut Function) -> FuncRef
fn declare_func_in_func(&self, func: FuncId, in_func: &mut Function) -> FuncRef
Use this when you’re building the IR of a function to reference a function. Read more
sourcefn declare_data_in_func(&self, data: DataId, func: &mut Function) -> GlobalValue
fn declare_data_in_func(&self, data: DataId, func: &mut Function) -> GlobalValue
Use this when you’re building the IR of a function to reference a data object. Read more
sourcefn declare_func_in_data(&self, func: FuncId, ctx: &mut DataContext) -> FuncRef
fn declare_func_in_data(&self, func: FuncId, ctx: &mut DataContext) -> FuncRef
TODO: Same as above.
sourcefn declare_data_in_data(
&self,
data: DataId,
ctx: &mut DataContext
) -> GlobalValue
fn declare_data_in_data(
&self,
data: DataId,
ctx: &mut DataContext
) -> GlobalValue
TODO: Same as above.
Auto Trait Implementations
impl !RefUnwindSafe for ObjectModule
impl Send for ObjectModule
impl Sync for ObjectModule
impl Unpin for ObjectModule
impl !UnwindSafe for ObjectModule
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more