pub struct Context {
pub modules: Arena<ModuleContent>,
pub functions: Arena<FunctionContent>,
pub blocks: Arena<BlockContent>,
pub values: Arena<ValueContent>,
pub pointers: Arena<PointerContent>,
pub aggregates: Arena<AggregateContent>,
pub abi_instances: Arena<AbiInstanceContent>,
pub asm_blocks: Arena<AsmBlockContent>,
/* private fields */
}
Expand description
The main IR context handle.
Every module, function, block and value is stored here. Some aggregate metadata is also managed by the context.
Fields
modules: Arena<ModuleContent>
functions: Arena<FunctionContent>
blocks: Arena<BlockContent>
values: Arena<ValueContent>
pointers: Arena<PointerContent>
aggregates: Arena<AggregateContent>
abi_instances: Arena<AbiInstanceContent>
asm_blocks: Arena<AsmBlockContent>
Implementations
sourceimpl Context
impl Context
sourcepub fn module_iter(&self) -> ModuleIteratorⓘNotable traits for ModuleIteratorimpl Iterator for ModuleIterator type Item = Module;
pub fn module_iter(&self) -> ModuleIteratorⓘNotable traits for ModuleIteratorimpl Iterator for ModuleIterator type Item = Module;
Return an interator for every module in this context.
sourcepub fn add_aggregate_symbols(
&mut self,
aggregate: Aggregate,
symbols: HashMap<String, u64>
) -> Result<(), String>
pub fn add_aggregate_symbols(
&mut self,
aggregate: Aggregate,
symbols: HashMap<String, u64>
) -> Result<(), String>
Add aggregate (struct) field names and their indicies to the context.
Used to symbolically cross-reference the index to aggregate fields by
Context::get_aggregate_index
.
sourcepub fn get_aggregate_by_name(&self, name: &str) -> Option<Aggregate>
pub fn get_aggregate_by_name(&self, name: &str) -> Option<Aggregate>
Return a named aggregate, if known.
sourcepub fn get_aggregate_index(
&self,
aggregate: &Aggregate,
field_name: &str
) -> Option<u64>
pub fn get_aggregate_index(
&self,
aggregate: &Aggregate,
field_name: &str
) -> Option<u64>
Get the field index within an aggregate (struct) by name, if known.
The field names must be registered already using Context::add_aggregate_symbols
.
sourcepub fn get_unique_name(&mut self) -> String
pub fn get_unique_name(&mut self) -> String
Get a globally unique symbol.
The name will be in the form "anon_N"
, where N
is an incrementing decimal.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more