Struct midenc_codegen_masm::Library 
source · pub struct Library {
    pub segments: DataSegmentTable,
    /* private fields */
}Expand description
A Library represents a set of modules and its dependencies, which are compiled/assembled together into a single artifact, and then linked into a Program for execution at a later time.
Modules are stored in a Library in a B-tree map, keyed by the module name. This is done to make accessing modules by name efficient, and to ensure a stable ordering for compiled programs when emitted as text.
Fields§
§segments: DataSegmentTableThe data segment table for this program
Implementations§
source§impl Library
 
impl Library
sourcepub fn new<M>(segments: DataSegmentTable, modules: M) -> Self
 
pub fn new<M>(segments: DataSegmentTable, modules: M) -> Self
Create a new Library initialized from a DataSegmentTable and a set of Modules.
You should generally prefer to use Library::from_hir, but this constructor allows you to manually produce a MASM program from its constituent parts.
sourcepub fn from_hir(
    program: &Program,
    globals: &GlobalVariableAnalysis<Program>,
) -> Self
 
pub fn from_hir( program: &Program, globals: &GlobalVariableAnalysis<Program>, ) -> Self
Create a new Library initialized from an hir::Program.
The resulting Library will have the following:
- Data segments described by the original hir::Program
None of the HIR modules will have been added yet
sourcepub fn link_kernel(&mut self, kernel: KernelLibrary)
 
pub fn link_kernel(&mut self, kernel: KernelLibrary)
Link this Library against the given kernel during assembly
sourcepub fn link_library(&mut self, library: CompiledLibrary)
 
pub fn link_library(&mut self, library: CompiledLibrary)
Link this Library against the given library during assembly
sourcepub fn link_libraries(&self) -> &[CompiledLibrary]
 
pub fn link_libraries(&self) -> &[CompiledLibrary]
Get the set of CompiledLibrary this library links against
sourcepub fn freeze(self: Box<Self>) -> Arc<Library>
 
pub fn freeze(self: Box<Self>) -> Arc<Library>
Freezes this library, preventing further modifications
sourcepub fn modules(&self) -> impl Iterator<Item = &Module> + '_
 
pub fn modules(&self) -> impl Iterator<Item = &Module> + '_
Get an iterator over the modules in this library
sourcepub fn unwrap_frozen_modules(&self) -> &FrozenModuleTree
 
pub fn unwrap_frozen_modules(&self) -> &FrozenModuleTree
Access the frozen module tree of this library, and panic if not frozen
sourcepub fn insert(&mut self, module: Box<Module>)
 
pub fn insert(&mut self, module: Box<Module>)
Insert a module into this library.
The insertion order is not preserved - modules are ordered by name.
NOTE: This function will panic if the program has been frozen
sourcepub fn get<Q>(&self, name: &Q) -> Option<&Module>
 
pub fn get<Q>(&self, name: &Q) -> Option<&Module>
Get a reference to a module in this library by name
sourcepub fn contains<N>(&self, name: N) -> bool
 
pub fn contains<N>(&self, name: N) -> bool
Returns true if this library contains a Module named name
sourcepub fn write_to_directory<P: AsRef<Path>>(
    &self,
    path: P,
    session: &Session,
) -> Result<()>
 
pub fn write_to_directory<P: AsRef<Path>>( &self, path: P, session: &Session, ) -> Result<()>
Write this Library to the given output directory.
pub fn assemble( &self, session: &Session, ) -> Result<Arc<CompiledLibrary>, Report>
Trait Implementations§
source§impl Emit for Library
 
impl Emit for Library
source§fn output_type(&self, _mode: OutputMode) -> OutputType
 
fn output_type(&self, _mode: OutputMode) -> OutputType
modesource§fn write_to<W: Write>(
    &self,
    writer: W,
    mode: OutputMode,
    _session: &Session,
) -> Result<()>
 
fn write_to<W: Write>( &self, writer: W, mode: OutputMode, _session: &Session, ) -> Result<()>
mode to determine the output
typesource§fn write_to_stdout(&self, session: &Session) -> Result<(), Error>
 
fn write_to_stdout(&self, session: &Session) -> Result<(), Error>
source§fn write_to_file(
    &self,
    path: &Path,
    mode: OutputMode,
    session: &Session,
) -> Result<(), Error>
 
fn write_to_file( &self, path: &Path, mode: OutputMode, session: &Session, ) -> Result<(), Error>
mode to determine the output typeAuto Trait Implementations§
impl Freeze for Library
impl !RefUnwindSafe for Library
impl Send for Library
impl !Sync for Library
impl Unpin for Library
impl !UnwindSafe for Library
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
 
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> Instrument for T
 
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§impl<D> OwoColorize for D
 
impl<D> OwoColorize for D
source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
    C: Color,
 
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
    C: Color,
source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
    C: Color,
 
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
    C: Color,
source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
 
fn black(&self) -> FgColorDisplay<'_, Black, Self>
source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
 
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
 
fn red(&self) -> FgColorDisplay<'_, Red, Self>
source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
 
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
 
fn green(&self) -> FgColorDisplay<'_, Green, Self>
source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
 
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
 
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
 
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
 
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
 
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
 
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
 
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
 
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
 
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
 
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
 
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
source§fn white(&self) -> FgColorDisplay<'_, White, Self>
 
fn white(&self) -> FgColorDisplay<'_, White, Self>
source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
 
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
 
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
 
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
 
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
 
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
 
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
 
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
 
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
 
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
 
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
 
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
 
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
 
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
 
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
 
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
 
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
 
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
 
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
 
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
 
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
 
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
source§fn bold(&self) -> BoldDisplay<'_, Self>
 
fn bold(&self) -> BoldDisplay<'_, Self>
source§fn dimmed(&self) -> DimDisplay<'_, Self>
 
fn dimmed(&self) -> DimDisplay<'_, Self>
source§fn italic(&self) -> ItalicDisplay<'_, Self>
 
fn italic(&self) -> ItalicDisplay<'_, Self>
source§fn underline(&self) -> UnderlineDisplay<'_, Self>
 
fn underline(&self) -> UnderlineDisplay<'_, Self>
source§fn blink(&self) -> BlinkDisplay<'_, Self>
 
fn blink(&self) -> BlinkDisplay<'_, Self>
source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
 
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
source§fn reversed(&self) -> ReversedDisplay<'_, Self>
 
fn reversed(&self) -> ReversedDisplay<'_, Self>
source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
 
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
    Color: DynColor,
 
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
    Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moresource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
    Color: DynColor,
 
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
    Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more