pub struct DataLayout { /* private fields */ }Expand description
Target specific data layout provided by LLVM.
Implementations§
Source§impl DataLayout
impl DataLayout
Sourcepub fn new(layout: &str) -> Self
pub fn new(layout: &str) -> Self
Build DataLayout as described by layout.
Warning: Aborts if layout is not a valid data layout string.
Sourcepub fn host() -> Result<Self>
pub fn host() -> Result<Self>
Build DataLayout of this (the host) machine.
Sourcepub fn from_module_layout(ctx: &Context, module: ModuleOp) -> Result<Self>
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.
Sourcepub fn string_representation(&self) -> String
pub fn string_representation(&self) -> String
The data layout string of this layout.
Sourcepub fn type_size_in_bits(
&mut self,
ctx: &Context,
ty: TypeHandle,
) -> Result<u64>
pub fn type_size_in_bits( &mut self, ctx: &Context, ty: TypeHandle, ) -> Result<u64>
The number of bits that ty holds.
Sourcepub fn type_store_size(&mut self, ctx: &Context, ty: TypeHandle) -> Result<u64>
pub fn type_store_size(&mut self, ctx: &Context, ty: TypeHandle) -> Result<u64>
The number of bytes that the data of ty uses.
Sourcepub fn type_alloc_size(&mut self, ctx: &Context, ty: TypeHandle) -> Result<u64>
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.
Sourcepub fn abi_type_align(&mut self, ctx: &Context, ty: TypeHandle) -> Result<u32>
pub fn abi_type_align(&mut self, ctx: &Context, ty: TypeHandle) -> Result<u32>
The alignment in bytes of ty, provided by the ABI.
Sourcepub fn packs_exactly(&mut self, ctx: &Context, ty: TypeHandle) -> Result<bool>
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§
impl !Send for DataLayout
impl !Sync for DataLayout
impl Freeze for DataLayout
impl RefUnwindSafe for DataLayout
impl Unpin for DataLayout
impl UnsafeUnpin for DataLayout
impl UnwindSafe for DataLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn 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>
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)
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)
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.