pub struct MetadataLoweringContext { /* private fields */ }Expand description
Symbol lookups backed by explicit, immutable program metadata.
Function indices retain metadata table order, independently of executable addresses. String lookups never append to or reorder the supplied table. The context is independent of any instruction set; dialect crates provide implementations of their lowering-capability traits for it.
Implementations§
Source§impl MetadataLoweringContext
impl MetadataLoweringContext
Sourcepub fn new<V, Ty, Info>(
metadata: &ProgramMetadata<V, Ty, Info>,
) -> Result<MetadataLoweringContext, Report>
pub fn new<V, Ty, Info>( metadata: &ProgramMetadata<V, Ty, Info>, ) -> Result<MetadataLoweringContext, Report>
Prepare section-wide string and function lookups.
§Errors
Rejects invalid function-name indices, duplicate function names, and
tables whose indices cannot be represented by u32. Full program
validation remains the responsibility of the metadata loading driver.
Sourcepub fn function_address(&self, name: &str) -> Result<u32, Report>
pub fn function_address(&self, name: &str) -> Result<u32, Report>
Look up a function’s executable start address.
Sourcepub fn function_index(&self, name: &str) -> Result<u32, Report>
pub fn function_index(&self, name: &str) -> Result<u32, Report>
Look up a function’s index in the supplied metadata table.
Trait Implementations§
Source§impl Debug for MetadataLoweringContext
impl Debug for MetadataLoweringContext
Source§impl FunctionScope for MetadataLoweringContext
impl FunctionScope for MetadataLoweringContext
Source§fn enter_function<'a>(
&mut self,
name: &str,
labels: impl IntoIterator<Item = (&'a str, usize)>,
) -> Result<(), Report>
fn enter_function<'a>( &mut self, name: &str, labels: impl IntoIterator<Item = (&'a str, usize)>, ) -> Result<(), Report>
Replace the active function’s labels, including forward references.
Auto Trait Implementations§
impl Freeze for MetadataLoweringContext
impl RefUnwindSafe for MetadataLoweringContext
impl Send for MetadataLoweringContext
impl Sync for MetadataLoweringContext
impl Unpin for MetadataLoweringContext
impl UnsafeUnpin for MetadataLoweringContext
impl UnwindSafe for MetadataLoweringContext
Blanket Implementations§
Source§impl<D> Apply<PushToStack<()>> for D
impl<D> Apply<PushToStack<()>> for D
Source§fn apply(&mut self, _: PushToStack<()>)
fn apply(&mut self, _: PushToStack<()>)
Apply a single effect to this destination.
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
Mutably borrows from an owned value. Read more