Struct cranelift_object::ObjectModule[][src]

pub struct ObjectModule { /* fields omitted */ }
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

impl ObjectModule[src]

pub fn new(builder: ObjectBuilder) -> Self[src]

Create a new ObjectModule using the given Cranelift target.

impl ObjectModule[src]

pub fn finish(self) -> ObjectProduct[src]

Finalize all relocations and output an object.

Trait Implementations

impl Module for ObjectModule[src]

fn isa(&self) -> &dyn TargetIsa[src]

Return the TargetIsa to compile for.

fn declarations(&self) -> &ModuleDeclarations[src]

Get all declarations in this module.

fn declare_function(
    &mut self,
    name: &str,
    linkage: Linkage,
    signature: &Signature
) -> ModuleResult<FuncId>
[src]

Declare a function in this module.

fn declare_data(
    &mut self,
    name: &str,
    linkage: Linkage,
    writable: bool,
    tls: bool
) -> ModuleResult<DataId>
[src]

Declare a data object in this module.

fn define_function(
    &mut self,
    func_id: FuncId,
    ctx: &mut Context,
    trap_sink: &mut dyn TrapSink,
    stack_map_sink: &mut dyn StackMapSink
) -> ModuleResult<ModuleCompiledFunction>
[src]

Define a function, producing the function body from the given Context. Read more

fn define_function_bytes(
    &mut self,
    func_id: FuncId,
    bytes: &[u8],
    relocs: &[RelocRecord]
) -> ModuleResult<ModuleCompiledFunction>
[src]

Define a function, taking the function body from the given bytes. Read more

fn define_data(
    &mut self,
    data_id: DataId,
    data_ctx: &DataContext
) -> ModuleResult<()>
[src]

Define a data object, producing the data contents from the given DataContext.

fn get_name(&self, name: &str) -> Option<FuncOrDataId>[src]

Get the module identifier for a given name, if that name has been declared. Read more

fn target_config(&self) -> TargetFrontendConfig[src]

Return the target information needed by frontends to produce Cranelift IR for the current target. Read more

fn make_context(&self) -> Context[src]

Create a new Context initialized for use with this Module. Read more

fn clear_context(&self, ctx: &mut Context)[src]

Clear the given Context and reset it for use with a new function. Read more

fn make_signature(&self) -> Signature[src]

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

fn clear_signature(&self, sig: &mut Signature)[src]

Clear the given Signature and reset for use with a new function. Read more

fn declare_func_in_func(&self, func: FuncId, in_func: &mut Function) -> FuncRef[src]

Use this when you’re building the IR of a function to reference a function. Read more

fn declare_data_in_func(&self, data: DataId, func: &mut Function) -> GlobalValue[src]

Use this when you’re building the IR of a function to reference a data object. Read more

fn declare_func_in_data(&self, func: FuncId, ctx: &mut DataContext) -> FuncRef[src]

TODO: Same as above.

fn declare_data_in_data(
    &self,
    data: DataId,
    ctx: &mut DataContext
) -> GlobalValue
[src]

TODO: Same as above.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.