[][src]Struct llhd::ir::Module

pub struct Module { /* fields omitted */ }

A module.

This is the root node of an LLHD intermediate representation. Contains Function, Process, and Entity declarations and definitions.

Implementations

impl Module[src]

pub fn new() -> Self[src]

Create a new empty module.

pub fn dump(&self) -> ModuleDumper<'_>[src]

Dump the module in human-readable form.

pub fn add_unit(&mut self, data: UnitData) -> UnitId[src]

Add a unit to the module.

pub fn remove_unit(&mut self, unit: UnitId)[src]

Remove a unit from the module.

pub fn declare(&mut self, name: UnitName, sig: Signature) -> DeclId[src]

Declare an external unit.

pub fn add_decl(&mut self, data: DeclData) -> DeclId[src]

Declare an external unit.

pub fn remove_decl(&mut self, decl: DeclId)[src]

Remove a declaration from the module.

pub fn units<'a>(&'a self) -> impl Iterator<Item = Unit<'a>> + 'a[src]

Return an iterator over the units in this module.

pub fn units_mut<'a>(&'a mut self) -> impl Iterator<Item = UnitBuilder<'a>> + 'a[src]

Return a mutable iterator over the units in this module.

pub fn par_units<'a>(&'a self) -> impl ParallelIterator<Item = Unit<'a>> + 'a[src]

Return a parallel iterator over the units in this module.

pub fn par_units_mut<'a>(
    &'a mut self
) -> impl ParallelIterator<Item = UnitBuilder<'a>> + 'a
[src]

Return a parallel mutable iterator over the units in this module.

pub fn functions<'a>(&'a self) -> impl Iterator<Item = Unit<'a>> + 'a[src]

Return an iterator over the functions in this module.

pub fn processes<'a>(&'a self) -> impl Iterator<Item = Unit<'a>> + 'a[src]

Return an iterator over the processes in this module.

pub fn entities<'a>(&'a self) -> impl Iterator<Item = Unit<'a>> + 'a[src]

Return an iterator over the entities in this module.

pub fn decls<'a>(&'a self) -> impl Iterator<Item = DeclId> + 'a[src]

Return an iterator over the external unit declarations in this module.

pub fn unit(&self, unit: UnitId) -> Unit<'_>[src]

Return an unit in the module.

pub fn unit_mut(&mut self, unit: UnitId) -> UnitBuilder<'_>[src]

Return a mutable unit in the module.

pub fn symbols<'a>(
    &'a self
) -> impl Iterator<Item = (&UnitName, LinkedUnit, &Signature)> + 'a
[src]

Return an iterator over the symbols in the module.

pub fn local_symbols<'a>(
    &'a self
) -> impl Iterator<Item = (&UnitName, LinkedUnit, &Signature)> + 'a
[src]

Return an iterator over the local symbols in the module.

pub fn global_symbols<'a>(
    &'a self
) -> impl Iterator<Item = (&UnitName, LinkedUnit, &Signature)> + 'a
[src]

Return an iterator over the global symbols in the module.

pub fn is_linked(&self) -> bool[src]

Check whether the module is internally linked.

Adding or modifying a unit invalidates the linkage within the module.

Locally link the module.

pub fn verify(&self)[src]

Panic if the module is not well-formed.

pub fn lookup_ext_unit(
    &self,
    ext_unit: ExtUnit,
    within: UnitId
) -> Option<LinkedUnit>
[src]

Lookup what an external unit links to.

The module must be linked for this to work.

pub fn set_location_hint(&mut self, mod_unit: UnitId, loc: usize)[src]

Add a location hint to a unit.

Annotates the byte offset of a unit in the input file.

pub fn location_hint(&self, mod_unit: UnitId) -> Option<usize>[src]

Get the location hint associated with a unit.

Returns the byte offset of the unit in the input file, or None if there is no hint for the value.

Trait Implementations

impl<'de> Deserialize<'de> for Module[src]

impl Index<DeclId> for Module[src]

type Output = DeclData

The returned type after indexing.

impl Index<UnitId> for Module[src]

type Output = UnitData

The returned type after indexing.

impl IndexMut<DeclId> for Module[src]

impl IndexMut<UnitId> for Module[src]

impl Serialize for Module[src]

Auto Trait Implementations

impl RefUnwindSafe for Module

impl Send for Module

impl Sync for Module

impl Unpin for Module

impl UnwindSafe for Module

Blanket Implementations

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

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

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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

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

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.

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.