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<Self>
pub fn new<V, Ty, Info>(metadata: &ProgramMetadata<V, Ty, Info>) -> Result<Self>
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>
pub fn function_address(&self, name: &str) -> Result<u32>
Look up a function’s executable start address.
Sourcepub fn function_index(&self, name: &str) -> Result<u32>
pub fn function_index(&self, name: &str) -> Result<u32>
Look up a function’s index in the supplied metadata table.
Sourcepub fn label_address(&self, name: &str) -> Result<u32>
pub fn label_address(&self, name: &str) -> Result<u32>
Look up a label in the current function’s scope.
Sourcepub fn string_index(&self, text: &str) -> Result<u32>
pub fn string_index(&self, text: &str) -> Result<u32>
Look up decoded string contents without modifying the supplied table. Equal strings resolve to the first matching table entry.