MapCtx

Struct MapCtx 

Source
#[non_exhaustive]
pub struct MapCtx<'ctx> { pub version: u64, pub datalayout: &'ctx DataLayout, pub section_table: &'ctx [String], pub gc_table: &'ctx [String], pub strtab: &'ctx Strtab, pub attribute_groups: &'ctx AttributeGroups, pub attributes: &'ctx Attributes, pub type_table: &'ctx TypeTable, pub comdats: &'ctx [Comdat], }
Expand description

A handle for various bits of state that are necessary for correct block and record mapping in the context of a particular IR module.

Block and record mapping operations are expected to update the supplied context, as appropriate.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§version: u64

The MODULE_CODE_VERSION for the IR module being mapped.

§datalayout: &'ctx DataLayout

The datalayout specification.

§section_table: &'ctx [String]

The section table.

§gc_table: &'ctx [String]

The GC table.

§strtab: &'ctx Strtab

The string table.

§attribute_groups: &'ctx AttributeGroups

Any attribute groups.

§attributes: &'ctx Attributes

Any raw attributes.

§type_table: &'ctx TypeTable

The type table.

§comdats: &'ctx [Comdat]

The COMDAT list.

Implementations§

Source§

impl MapCtx<'_>

Source

pub fn use_strtab(&self) -> bool

A helper function for whether or not to use an associated string table for string lookups.

This corresponds to MODULE_CODE_VERSIONs of 2 and higher.

Source

pub fn use_relative_ids(&self) -> bool

A helper function for determining how operands are encoded.

This corresponds to MODULE_CODE_VERSIONs of 1 and higher.

Trait Implementations§

Source§

impl<'ctx> Debug for MapCtx<'ctx>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'ctx> Freeze for MapCtx<'ctx>

§

impl<'ctx> RefUnwindSafe for MapCtx<'ctx>

§

impl<'ctx> Send for MapCtx<'ctx>

§

impl<'ctx> Sync for MapCtx<'ctx>

§

impl<'ctx> Unpin for MapCtx<'ctx>

§

impl<'ctx> UnwindSafe for MapCtx<'ctx>

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<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.

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.