cranelift_codegen::write

Trait FuncWriter

Source
pub trait FuncWriter {
    // Required methods
    fn write_block_header(
        &mut self,
        w: &mut dyn Write,
        func: &Function,
        block: Block,
        indent: usize,
    ) -> Result;
    fn write_instruction(
        &mut self,
        w: &mut dyn Write,
        func: &Function,
        aliases: &SecondaryMap<Value, Vec<Value>>,
        inst: Inst,
        indent: usize,
    ) -> Result;

    // Provided methods
    fn write_preamble(
        &mut self,
        w: &mut dyn Write,
        func: &Function,
    ) -> Result<bool, Error> { ... }
    fn super_preamble(
        &mut self,
        w: &mut dyn Write,
        func: &Function,
    ) -> Result<bool, Error> { ... }
    fn write_entity_definition(
        &mut self,
        w: &mut dyn Write,
        func: &Function,
        entity: AnyEntity,
        value: &dyn Display,
        maybe_fact: Option<&Fact>,
    ) -> Result { ... }
    fn super_entity_definition(
        &mut self,
        w: &mut dyn Write,
        func: &Function,
        entity: AnyEntity,
        value: &dyn Display,
        maybe_fact: Option<&Fact>,
    ) -> Result { ... }
}
Expand description

A FuncWriter used to decorate functions during printing.

Required Methods§

Source

fn write_block_header( &mut self, w: &mut dyn Write, func: &Function, block: Block, indent: usize, ) -> Result

Write the basic block header for the current function.

Source

fn write_instruction( &mut self, w: &mut dyn Write, func: &Function, aliases: &SecondaryMap<Value, Vec<Value>>, inst: Inst, indent: usize, ) -> Result

Write the given inst to w.

Provided Methods§

Source

fn write_preamble( &mut self, w: &mut dyn Write, func: &Function, ) -> Result<bool, Error>

Write the preamble to w. By default, this uses write_entity_definition.

Source

fn super_preamble( &mut self, w: &mut dyn Write, func: &Function, ) -> Result<bool, Error>

Default impl of write_preamble

Source

fn write_entity_definition( &mut self, w: &mut dyn Write, func: &Function, entity: AnyEntity, value: &dyn Display, maybe_fact: Option<&Fact>, ) -> Result

Write an entity definition defined in the preamble to w.

Source

fn super_entity_definition( &mut self, w: &mut dyn Write, func: &Function, entity: AnyEntity, value: &dyn Display, maybe_fact: Option<&Fact>, ) -> Result

Default impl of write_entity_definition

Implementors§