rustc_codegen_ssa::traits

Trait LayoutTypeCodegenMethods

source
pub trait LayoutTypeCodegenMethods<'tcx>: BackendTypes {
    // Required methods
    fn backend_type(&self, layout: TyAndLayout<'tcx>) -> Self::Type;
    fn cast_backend_type(&self, ty: &CastTarget) -> Self::Type;
    fn fn_decl_backend_type(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>) -> Self::Type;
    fn fn_ptr_backend_type(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>) -> Self::Type;
    fn reg_backend_type(&self, ty: &Reg) -> Self::Type;
    fn immediate_backend_type(&self, layout: TyAndLayout<'tcx>) -> Self::Type;
    fn is_backend_immediate(&self, layout: TyAndLayout<'tcx>) -> bool;
    fn is_backend_scalar_pair(&self, layout: TyAndLayout<'tcx>) -> bool;
    fn scalar_pair_element_backend_type(
        &self,
        layout: TyAndLayout<'tcx>,
        index: usize,
        immediate: bool,
    ) -> Self::Type;

    // Provided method
    fn is_backend_ref(&self, layout: TyAndLayout<'tcx>) -> bool { ... }
}

Required Methods§

source

fn backend_type(&self, layout: TyAndLayout<'tcx>) -> Self::Type

The backend type used for a rust type when it’s in memory, such as when it’s stack-allocated or when it’s being loaded or stored.

source

fn cast_backend_type(&self, ty: &CastTarget) -> Self::Type

source

fn fn_decl_backend_type(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>) -> Self::Type

source

fn fn_ptr_backend_type(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>) -> Self::Type

source

fn reg_backend_type(&self, ty: &Reg) -> Self::Type

source

fn immediate_backend_type(&self, layout: TyAndLayout<'tcx>) -> Self::Type

The backend type used for a rust type when it’s in an SSA register.

For nearly all types this is the same as the Self::backend_type, however bool (and other 0-or-1 values) are kept as i1 in registers but as BaseTypeCodegenMethods::type_i8 in memory.

Converting values between the two different backend types is done using from_immediate and to_immediate_scalar.

source

fn is_backend_immediate(&self, layout: TyAndLayout<'tcx>) -> bool

source

fn is_backend_scalar_pair(&self, layout: TyAndLayout<'tcx>) -> bool

source

fn scalar_pair_element_backend_type( &self, layout: TyAndLayout<'tcx>, index: usize, immediate: bool, ) -> Self::Type

Provided Methods§

source

fn is_backend_ref(&self, layout: TyAndLayout<'tcx>) -> bool

A type that produces an OperandValue::Ref when loaded.

AKA one that’s not a ZST, not is_backend_immediate, and not is_backend_scalar_pair. For such a type, a load_operand doesn’t actually load anything.

Implementors§