/// Emit the instructions to a list of sections.
Emit the instructions to a list of sections.
Emit the instructions to a list of sections .
pub fn emit(&self) -> MachSections
    where
        I: MachInstEmit<MachSection>,
    {
        let mut sections = MachSections::new();
        let code_idx = sections.add_section(0, self.code_size);
        let const_idx = sections.add_section(self.constants_start, self.constants_size);
        let (code_section, const_section) = sections.two_sections(code_idx, const_idx);
        for block in &self.final_block_order {
            let new_offset = I::align_basic_block(code_section.cur_offset_from_start());
            while new_offset > code_section.cur_offset_from_start() {
                // Pad with NOPs up to the aligned block offset.
                let nop = I::gen_nop((new_offset - code_section.cur_offset_from_start()) as usize);
                nop.emit(code_section, const_section);
            }
            assert_eq!(code_section.cur_offset_from_start(), new_offset);
            let (start, end) = self.block_ranges[*block as usize];
            for iix in start..end {
                self.insts[iix as usize].emit(code_section, const_section);
            }
        }
        sections
    }
pub fn emit ( & self ) -> MachSections where I : MachInstEmit < MachSection > , { let mut sections = MachSections :: new ( ) ; let code_idx = sections . add_section ( 0 , self . code_size ) ; let const_idx = sections . add_section ( self . constants_start , self . constants_size ) ; let ( code_section , const_section ) = sections . two_sections ( code_idx , const_idx ) ; for block in & self . final_block_order { let new_offset = I :: align_basic_block ( code_section . cur_offset_from_start ( ) ) ; while new_offset > code_section . cur_offset_from_start ( ) { // Pad with NOPs up to the aligned block offset. let nop = I :: gen_nop ( ( new_offset - code_section . cur_offset_from_start ( ) ) as usize ) ; nop . emit ( code_section , const_section ) ; } assert_eq ! ( code_section cur_offset_from_start ( ) new_offset ) ; let ( start , end ) = self . block_ranges [ * block as usize ] ; for iix in start .. end { self . insts [ iix as usize ] . emit ( code_section , const_section ) ; } } sections }
Emit the instructions to a list of sections.
Emit the instructions to a list of sections .
&self