pub(crate) trait LayoutLlvmExt<'tcx> {
// Required methods
fn llvm_type<'ll>(
&self,
cx: &GenericCx<'ll, FullCx<'ll, 'tcx>>,
) -> Type<'ll>;
fn immediate_llvm_type<'ll>(
&self,
cx: &GenericCx<'ll, FullCx<'ll, 'tcx>>,
) -> Type<'ll>;
fn scalar_llvm_type_at<'ll>(
&self,
cx: &GenericCx<'ll, FullCx<'ll, 'tcx>>,
scalar: Scalar,
) -> Type<'ll>;
fn scalar_pair_element_llvm_type<'ll>(
&self,
cx: &GenericCx<'ll, FullCx<'ll, 'tcx>>,
index: usize,
immediate: bool,
) -> Type<'ll>;
}Required Methods§
fn llvm_type<'ll>(&self, cx: &GenericCx<'ll, FullCx<'ll, 'tcx>>) -> Type<'ll>
fn immediate_llvm_type<'ll>( &self, cx: &GenericCx<'ll, FullCx<'ll, 'tcx>>, ) -> Type<'ll>
fn scalar_llvm_type_at<'ll>( &self, cx: &GenericCx<'ll, FullCx<'ll, 'tcx>>, scalar: Scalar, ) -> Type<'ll>
fn scalar_pair_element_llvm_type<'ll>( &self, cx: &GenericCx<'ll, FullCx<'ll, 'tcx>>, index: usize, immediate: bool, ) -> Type<'ll>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx>
impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx>
Source§fn llvm_type<'ll>(&self, cx: &GenericCx<'ll, FullCx<'ll, 'tcx>>) -> Type<'ll>
fn llvm_type<'ll>(&self, cx: &GenericCx<'ll, FullCx<'ll, 'tcx>>) -> Type<'ll>
Gets the LLVM type corresponding to a Rust type, i.e., rustc_middle::ty::Ty.
For sized types, this is the in-memory type that is used for stores and loads.
The type used for immediates may be different, see Self::immediate_llvm_type.
Unsized types, however, are represented by a “minimal unit”, e.g.
[T] becomes T, while str and Trait turn into i8 - this
is useful for indexing slices, as &[T]’s data pointer is T*.
If the type is an unsized struct, the regular layout is generated, with the innermost trailing unsized field using the “minimal unit” of that field’s type - this is useful for taking the address of that field and ensuring the struct has the right alignment.