Struct cranelift_module::Module [−][src]
pub struct Module<B> where
B: Backend, { /* fields omitted */ }A Module is a utility for collecting functions and data objects, and linking them together.
Methods
impl<B> Module<B> where
B: Backend, [src]
impl<B> Module<B> where
B: Backend, pub fn new(backend_builder: B::Builder) -> Self[src]
pub fn new(backend_builder: B::Builder) -> SelfCreate a new Module.
pub fn get_name(&self, name: &str) -> Option<FuncOrDataId>[src]
pub fn get_name(&self, name: &str) -> Option<FuncOrDataId>Get the module identifier for a given name, if that name has been declared.
pub fn pointer_type(&self) -> Type[src]
pub fn pointer_type(&self) -> TypeReturn then pointer type for the current target.
pub fn make_context(&self) -> Context[src]
pub fn make_context(&self) -> ContextCreate a new Context initialized for use with this Module.
This ensures that the Context is initialized with the default calling
convention for the TargetIsa.
pub fn clear_context(&self, ctx: &mut Context)[src]
pub fn clear_context(&self, ctx: &mut Context)Create a new Context initialized for use with this Module.
This ensures that the Context is initialized with the default calling
convention for the TargetIsa.
pub fn declare_function(
&mut self,
name: &str,
linkage: Linkage,
signature: &Signature
) -> ModuleResult<FuncId>[src]
pub fn declare_function(
&mut self,
name: &str,
linkage: Linkage,
signature: &Signature
) -> ModuleResult<FuncId>Declare a function in this module.
pub fn declare_data(
&mut self,
name: &str,
linkage: Linkage,
writable: bool
) -> ModuleResult<DataId>[src]
pub fn declare_data(
&mut self,
name: &str,
linkage: Linkage,
writable: bool
) -> ModuleResult<DataId>Declare a data object in this module.
pub fn declare_func_in_func(
&self,
func: FuncId,
in_func: &mut Function
) -> FuncRef[src]
pub fn declare_func_in_func(
&self,
func: FuncId,
in_func: &mut Function
) -> FuncRefUse this when you're building the IR of a function to reference a function.
TODO: Coalesce redundant decls and signatures. TODO: Look into ways to reduce the risk of using a FuncRef in the wrong function.
pub fn declare_data_in_func(
&self,
data: DataId,
func: &mut Function
) -> GlobalValue[src]
pub fn declare_data_in_func(
&self,
data: DataId,
func: &mut Function
) -> GlobalValueUse this when you're building the IR of a function to reference a data object.
TODO: Same as above.
pub fn declare_func_in_data(
&self,
func: FuncId,
ctx: &mut DataContext
) -> FuncRef[src]
pub fn declare_func_in_data(
&self,
func: FuncId,
ctx: &mut DataContext
) -> FuncRefTODO: Same as above.
pub fn declare_data_in_data(
&self,
data: DataId,
ctx: &mut DataContext
) -> GlobalValue[src]
pub fn declare_data_in_data(
&self,
data: DataId,
ctx: &mut DataContext
) -> GlobalValueTODO: Same as above.
pub fn define_function(
&mut self,
func: FuncId,
ctx: &mut Context
) -> ModuleResult<()>[src]
pub fn define_function(
&mut self,
func: FuncId,
ctx: &mut Context
) -> ModuleResult<()>Define a function, producing the function body from the given Context.
pub fn define_data(
&mut self,
data: DataId,
data_ctx: &DataContext
) -> ModuleResult<()>[src]
pub fn define_data(
&mut self,
data: DataId,
data_ctx: &DataContext
) -> ModuleResult<()>Define a function, producing the data contents from the given DataContext.
pub fn write_data_funcaddr(
&mut self,
data: DataId,
offset: usize,
what: FuncRef
)[src]
pub fn write_data_funcaddr(
&mut self,
data: DataId,
offset: usize,
what: FuncRef
)Write the address of what into the data for data at offset. data must refer to a
defined data object.
pub fn write_data_dataaddr(
&mut self,
data: DataId,
offset: usize,
what: GlobalValue,
addend: Addend
)[src]
pub fn write_data_dataaddr(
&mut self,
data: DataId,
offset: usize,
what: GlobalValue,
addend: Addend
)Write the address of what plus addend into the data for data at offset. data must
refer to a defined data object.
pub fn finalize_function(&mut self, func: FuncId) -> B::FinalizedFunction[src]
pub fn finalize_function(&mut self, func: FuncId) -> B::FinalizedFunctionPerform all outstanding relocations on the given function. This requires all Local
and Export entities referenced to be defined.
pub fn finalize_data(&mut self, data: DataId) -> B::FinalizedData[src]
pub fn finalize_data(&mut self, data: DataId) -> B::FinalizedDataPerform all outstanding relocations on the given data object. This requires all
Local and Export entities referenced to be defined.
pub fn finalize_all(&mut self)[src]
pub fn finalize_all(&mut self)Finalize all functions and data objects. Note that this doesn't return the
final artifacts returned from finalize_function or finalize_data.
pub fn finish(self) -> B::Product[src]
pub fn finish(self) -> B::ProductConsume the module and return the resulting Product. Some Backend
implementations may provide additional functionality available after
a Module is complete.
Auto Trait Implementations
impl<B> Send for Module<B> where
B: Send,
<B as Backend>::CompiledData: Send,
<B as Backend>::CompiledFunction: Send,
impl<B> Send for Module<B> where
B: Send,
<B as Backend>::CompiledData: Send,
<B as Backend>::CompiledFunction: Send, impl<B> Sync for Module<B> where
B: Sync,
<B as Backend>::CompiledData: Sync,
<B as Backend>::CompiledFunction: Sync,
impl<B> Sync for Module<B> where
B: Sync,
<B as Backend>::CompiledData: Sync,
<B as Backend>::CompiledFunction: Sync,