Skip to main content

DataLayout

Struct DataLayout 

Source
pub struct DataLayout { /* private fields */ }
Expand description

Target specific data layout provided by LLVM.

Implementations§

Source§

impl DataLayout

Source

pub fn new(layout: &str) -> Self

Build DataLayout as described by layout.

Warning: Aborts if layout is not a valid data layout string.

Source

pub fn host() -> Result<Self>

Build DataLayout of this (the host) machine.

Source

pub fn from_module_layout(ctx: &Context, module: ModuleOp) -> Result<Self>

Build DataLayout based on a module’s layout, if it has one. Falls back to Self::host if module doesn’t have a layout set.

Source

pub fn string_representation(&self) -> String

The data layout string of this layout.

Source

pub fn type_size_in_bits( &mut self, ctx: &Context, ty: TypeHandle, ) -> Result<u64>

The number of bits that ty holds.

Source

pub fn type_store_size(&mut self, ctx: &Context, ty: TypeHandle) -> Result<u64>

The number of bytes that the data of ty uses.

Source

pub fn type_alloc_size(&mut self, ctx: &Context, ty: TypeHandle) -> Result<u64>

The number of bytes that one element of an array of ty uses.

Source

pub fn abi_type_align(&mut self, ctx: &Context, ty: TypeHandle) -> Result<u32>

The alignment in bytes of ty, provided by the ABI.

Source

pub fn packs_exactly(&mut self, ctx: &Context, ty: TypeHandle) -> Result<bool>

Does an array of ty hold its elements with no padding between them?

This is equivalent to Self::type_store_size == Self::type_alloc_size

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
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.