Skip to main content

MetadataLoweringContext

Struct MetadataLoweringContext 

Source
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

Source

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.

Source

pub fn function_address(&self, name: &str) -> Result<u32, Report>

Look up a function’s executable start address.

Source

pub fn function_index(&self, name: &str) -> Result<u32, Report>

Look up a function’s index in the supplied metadata table.

Source

pub fn label_address(&self, name: &str) -> Result<u32, Report>

Look up a label in the current function’s scope.

Source

pub fn string_index(&self, text: &str) -> Result<u32, Report>

Look up decoded string contents without modifying the supplied table. Equal strings resolve to the first matching table entry.

Trait Implementations§

Source§

impl Debug for MetadataLoweringContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl FunctionScope for MetadataLoweringContext

Source§

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<D> Apply<PushToStack<()>> for D

Source§

fn apply(&mut self, _: PushToStack<()>)

Apply a single effect to this destination.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

§

type Proj<U: 'src> = U

§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.