[−][src]Struct llhd::ir::prelude::Module
A module.
This is the root node of an LLHD intermediate representation. Contains
Function
, Process
, and Entity
declarations and definitions.
Methods
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_function(&mut self, func: Function) -> ModUnit
[src]
Add a function to the module.
pub fn add_process(&mut self, prok: Process) -> ModUnit
[src]
Add a process to the module.
pub fn add_entity(&mut self, ent: Entity) -> ModUnit
[src]
Add an entity to the module.
pub fn declare(&mut self, name: UnitName, sig: Signature) -> ModUnit
[src]
Declare an external unit.
pub fn remove_unit(&mut self, unit: ModUnit)
[src]
Remove a unit from the module.
pub fn units<'a>(&'a self) -> impl Iterator<Item = ModUnit> + 'a
[src]
Return an iterator over the units in this module.
pub fn functions<'a>(&'a self) -> impl Iterator<Item = &'a Function> + 'a
[src]
Return an iterator over the functions in this module.
pub fn processes<'a>(&'a self) -> impl Iterator<Item = &'a Process> + 'a
[src]
Return an iterator over the processes in this module.
pub fn entities<'a>(&'a self) -> impl Iterator<Item = &'a Entity> + 'a
[src]
Return an iterator over the entities in this module.
pub fn all_units<'a>(&'a self) -> impl Iterator<Item = &'a dyn Unit> + 'a
[src]
Return an iterator over the units in this module.
pub fn declarations<'a>(
&'a self
) -> impl Iterator<Item = (&'a UnitName, &'a Signature)> + 'a
[src]
&'a self
) -> impl Iterator<Item = (&'a UnitName, &'a Signature)> + 'a
Return an iterator over the external unit declarations in this module.
pub fn is_function(&self, unit: ModUnit) -> bool
[src]
Check whether a unit is a function.
pub fn is_process(&self, unit: ModUnit) -> bool
[src]
Check whether a unit is a process.
pub fn is_entity(&self, unit: ModUnit) -> bool
[src]
Check whether a unit is an entity.
pub fn is_declaration(&self, unit: ModUnit) -> bool
[src]
Check whether a unit is externally declared.
pub fn unit_name(&self, unit: ModUnit) -> &UnitName
[src]
Get the name of a unit.
pub fn unit_sig(&self, unit: ModUnit) -> &Signature
[src]
Get the signature of a unit.
pub fn get_function(&self, unit: ModUnit) -> Option<&Function>
[src]
Return a function in the module, or None
if the unit is not a
function.
pub fn get_function_mut(&mut self, unit: ModUnit) -> Option<&mut Function>
[src]
Return a mutable function in the module, or None
if the unit is not a
function.
pub fn function(&self, unit: ModUnit) -> &Function
[src]
Return a function in the module. Panic if the unit is not a function.
pub fn function_mut(&mut self, unit: ModUnit) -> &mut Function
[src]
Return a mutable function in the module. Panic if the unit is not a function.
pub fn get_process(&self, unit: ModUnit) -> Option<&Process>
[src]
Return a process in the module, or None
if the unit is not a
process.
pub fn get_process_mut(&mut self, unit: ModUnit) -> Option<&mut Process>
[src]
Return a mutable process in the module, or None
if the unit is not a
process.
pub fn process(&self, unit: ModUnit) -> &Process
[src]
Return a process in the module. Panic if the unit is not a process.
pub fn process_mut(&mut self, unit: ModUnit) -> &mut Process
[src]
Return a mutable process in the module. Panic if the unit is not a process.
pub fn get_entity(&self, unit: ModUnit) -> Option<&Entity>
[src]
Return an entity in the module, or None
if the unit is not an
entity.
pub fn get_entity_mut(&mut self, unit: ModUnit) -> Option<&mut Entity>
[src]
Return a mutable entity in the module, or None
if the unit is not an
entity.
pub fn entity(&self, unit: ModUnit) -> &Entity
[src]
Return an entity in the module. Panic if the unit is not an entity.
pub fn entity_mut(&mut self, unit: ModUnit) -> &mut Entity
[src]
Return a mutable entity in the module. Panic if the unit is not an entity.
pub fn get_unit(&self, unit: ModUnit) -> Option<&dyn Unit>
[src]
Return a unit in the module, or None
if the unit is a declaration.
pub fn get_unit_mut(&mut self, unit: ModUnit) -> Option<&mut dyn Unit>
[src]
Return a mutable entity in the module, or None
if the unit is a
declaration.
pub fn unit(&self, unit: ModUnit) -> &dyn Unit
[src]
Return an unit in the module. Panic if the unit is a declaration.
pub fn unit_mut(&mut self, unit: ModUnit) -> &mut dyn Unit
[src]
Return a mutable unit in the module. Panic if the unit is a declaration.
pub fn symbols<'a>(&'a self) -> impl Iterator<Item = (&UnitName, ModUnit)> + 'a
[src]
Return an iterator over the symbols in the module.
pub fn local_symbols<'a>(
&'a self
) -> impl Iterator<Item = (&UnitName, ModUnit)> + 'a
[src]
&'a self
) -> impl Iterator<Item = (&UnitName, ModUnit)> + 'a
Return an iterator over the local symbols in the module.
pub fn global_symbols<'a>(
&'a self
) -> impl Iterator<Item = (&UnitName, ModUnit)> + 'a
[src]
&'a self
) -> impl Iterator<Item = (&UnitName, ModUnit)> + 'a
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.
pub fn link(&mut self)
[src]
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: ModUnit
) -> Option<ModUnit>
[src]
&self,
ext_unit: ExtUnit,
within: ModUnit
) -> Option<ModUnit>
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: ModUnit, 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: ModUnit) -> 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]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Index<ModUnit> for Module
[src]
type Output = ModUnitData
The returned type after indexing.
fn index(&self, idx: ModUnit) -> &ModUnitData
[src]
impl IndexMut<ModUnit> for Module
[src]
fn index_mut(&mut self, idx: ModUnit) -> &mut ModUnitData
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,