rustc_codegen_llvm::type_of

Trait LayoutLlvmExt

Source
pub(crate) trait LayoutLlvmExt<'tcx> {
    // Required methods
    fn is_llvm_immediate(&self) -> bool;
    fn is_llvm_scalar_pair(&self) -> bool;
    fn llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> &'a Type;
    fn immediate_llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> &'a Type;
    fn scalar_llvm_type_at<'a>(
        &self,
        cx: &CodegenCx<'a, 'tcx>,
        scalar: Scalar,
    ) -> &'a Type;
    fn scalar_pair_element_llvm_type<'a>(
        &self,
        cx: &CodegenCx<'a, 'tcx>,
        index: usize,
        immediate: bool,
    ) -> &'a Type;
}

Required Methods§

Source

fn is_llvm_immediate(&self) -> bool

Source

fn is_llvm_scalar_pair(&self) -> bool

Source

fn llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> &'a Type

Source

fn immediate_llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> &'a Type

Source

fn scalar_llvm_type_at<'a>( &self, cx: &CodegenCx<'a, 'tcx>, scalar: Scalar, ) -> &'a Type

Source

fn scalar_pair_element_llvm_type<'a>( &self, cx: &CodegenCx<'a, 'tcx>, index: usize, immediate: bool, ) -> &'a Type

Implementations on Foreign Types§

Source§

impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx>

Source§

fn llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> &'a Type

Gets the LLVM type corresponding to a Rust type, i.e., rustc_middle::ty::Ty. The pointee type of the pointer in PlaceRef is always this type. For sized types, it is also the right LLVM type for an alloca containing a value of that type, and most immediates (except bool). 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.

Source§

fn is_llvm_immediate(&self) -> bool

Source§

fn is_llvm_scalar_pair(&self) -> bool

Source§

fn immediate_llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> &'a Type

Source§

fn scalar_llvm_type_at<'a>( &self, cx: &CodegenCx<'a, 'tcx>, scalar: Scalar, ) -> &'a Type

Source§

fn scalar_pair_element_llvm_type<'a>( &self, cx: &CodegenCx<'a, 'tcx>, index: usize, immediate: bool, ) -> &'a Type

Implementors§