Skip to main content

DataLayout

Struct DataLayout 

Source
pub struct DataLayout {
    pub little_endian: bool,
    pub pointer_bits: u32,
    pub pointer_align: u32,
    pub i64_align: u32,
    pub f80_align: Option<u32>,
    pub stack_align: u32,
}
Expand description

The layout facts a printed module carries so it can be compiled without the command line that produced it.

A subset of the string LLVM writes, in the same syntax, because that syntax is what tools around the ecosystem already read. It says what the module was built assuming, and the verifier is what checks it against the target actually being compiled for: a module built for a 64-bit pointer cannot be finished for a 32-bit one, and finding that out here is better than finding it out as wrong output.

Fields§

§little_endian: bool

Whether the low byte of a scalar is stored first.

§pointer_bits: u32

The width of a pointer in bits.

§pointer_align: u32

The alignment of a pointer in bits.

§i64_align: u32

The alignment of a 64-bit integer in bits, which is the one integer alignment that varies across the targets anybody still builds for.

§f80_align: Option<u32>

The alignment of the x87 eighty bit format in bits, and None on a target that does not have it.

§stack_align: u32

The alignment the stack is kept at in bits, which is 128 on every target here.

Implementations§

Source§

impl DataLayout

Source

pub fn for_target(target: &TargetInfo) -> Self

The layout of that target.

Source

pub fn parse(text: &str) -> Option<Self>

The layout back from the string Display wrote, or None if the string is not one.

The fields may come in any order, because a string written by hand will not have them in ours. A string this crate printed round-trips byte for byte, which is what spec/03-architecture.md asks of the textual form.

Trait Implementations§

Source§

impl Clone for DataLayout

Source§

fn clone(&self) -> DataLayout

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for DataLayout

Source§

impl Debug for DataLayout

Source§

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

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

impl Display for DataLayout

Source§

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

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

impl Eq for DataLayout

Source§

impl PartialEq for DataLayout

Source§

fn eq(&self, other: &DataLayout) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DataLayout

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<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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.