Struct cretonne_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]
B: Backend,
pub fn new(backend: B) -> Self
[src]
Create a new Module
.
pub fn pointer_type(&self) -> Type
[src]
Return then pointer type for the current target.
pub fn declare_function(
&mut self,
name: &str,
linkage: Linkage,
signature: &Signature
) -> Result<FuncId, CtonError>
[src]
&mut self,
name: &str,
linkage: Linkage,
signature: &Signature
) -> Result<FuncId, CtonError>
Declare a function in this module.
pub fn declare_data(
&mut self,
name: &str,
linkage: Linkage,
writable: bool
) -> Result<DataId, CtonError>
[src]
&mut self,
name: &str,
linkage: Linkage,
writable: bool
) -> Result<DataId, CtonError>
Declare a data object in this module.
pub fn declare_func_in_func(
&self,
func: FuncId,
in_func: &mut Function
) -> FuncRef
[src]
&self,
func: FuncId,
in_func: &mut Function
) -> FuncRef
Use 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
) -> GlobalVar
[src]
&self,
data: DataId,
func: &mut Function
) -> GlobalVar
Use 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]
&self,
func: FuncId,
ctx: &mut DataContext
) -> FuncRef
TODO: Same as above.
pub fn declare_data_in_data(
&self,
data: DataId,
ctx: &mut DataContext
) -> GlobalVar
[src]
&self,
data: DataId,
ctx: &mut DataContext
) -> GlobalVar
TODO: Same as above.
pub fn define_function(&mut self, func: FuncId, ctx: &mut Context) -> CtonResult
[src]
Define a function, producing the function body from the given Context
.
pub fn define_data(
&mut self,
data: DataId,
data_ctx: &DataContext
) -> CtonResult
[src]
&mut self,
data: DataId,
data_ctx: &DataContext
) -> CtonResult
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]
&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: GlobalVar,
addend: Addend
)
[src]
&mut self,
data: DataId,
offset: usize,
what: GlobalVar,
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]
Perform 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]
Perform 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]
Finalize all functions and data objects. Note that this doesn't return the
final artifacts returned from finalize_function
or finalize_data
.
pub fn consume(self) -> B
[src]
Consume the module and return its contained Backend
. Some Backend
implementations have additional features not available through the
Module
interface.
Trait Implementations
Auto Trait Implementations
impl<B> Send for Module<B> where
B: Send,
<B as Backend>::CompiledData: Send,
<B as Backend>::CompiledFunction: Send,
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,
B: Sync,
<B as Backend>::CompiledData: Sync,
<B as Backend>::CompiledFunction: Sync,