Trait rustc_codegen_llvm::type_of::LayoutLlvmExt

source ·
pub 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 inner-most 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§