spirt::qptr::lift

Struct LiftToSpvPtrs

source
pub struct LiftToSpvPtrs<'a> {
    cx: Rc<Context>,
    wk: &'static WellKnown,
    layout_cache: LayoutCache<'a>,
    cached_u32_type: Cell<Option<Type>>,
}
Expand description

Context for lifting QPtrs to SPIR-V OpTypePointers.

See also passes::qptr::lift_to_spv_ptrs (which drives this).

Fields§

§cx: Rc<Context>§wk: &'static WellKnown§layout_cache: LayoutCache<'a>§cached_u32_type: Cell<Option<Type>>

Implementations§

source§

impl<'a> LiftToSpvPtrs<'a>

source

pub fn new(cx: Rc<Context>, layout_config: &'a LayoutConfig) -> Self

source

pub fn lift_global_var(&self, global_var_decl: &mut GlobalVarDecl)

source

pub fn lift_all_funcs( &self, module: &mut Module, funcs: impl IntoIterator<Item = Func>, )

source

fn find_qptr_usage_attr(&self, attrs: AttrSet) -> Result<&QPtrUsage, LiftError>

source

fn strip_qptr_usage_attr(&self, attrs: AttrSet) -> AttrSet

source

fn spv_ptr_type_and_addr_space_for_global_var( &self, global_var_decl: &GlobalVarDecl, ) -> Result<(Type, AddrSpace), LiftError>

source

fn as_spv_ptr_type(&self, ty: Type) -> Option<(AddrSpace, Type)>

Returns Some iff ty is a SPIR-V OpTypePointer.

source

fn spv_ptr_type(&self, addr_space: AddrSpace, pointee_type: Type) -> Type

source

fn pointee_type_for_usage(&self, usage: &QPtrUsage) -> Result<Type, LiftError>

source

fn pointee_type_for_mem_usage( &self, usage: &QPtrMemUsage, ) -> Result<Type, LiftError>

source

fn spv_op_type_array( &self, element_type: Type, fixed_len: Option<u32>, stride: Option<NonZeroU32>, ) -> Result<Type, LiftError>

source

fn spv_op_type_struct( &self, field_offsets_and_types: impl IntoIterator<Item = Result<(u32, Type), LiftError>>, extra_attrs: impl IntoIterator<Item = Attr>, ) -> Result<Type, LiftError>

source

fn u32_type(&self) -> Type

Get the (likely cached) u32 type.

source

fn const_u32(&self, x: u32) -> Const

source

fn layout_of(&self, ty: Type) -> Result<TypeLayout, LiftError>

Attempt to compute a TypeLayout for a given (SPIR-V) Type.

Auto Trait Implementations§

§

impl<'a> !Freeze for LiftToSpvPtrs<'a>

§

impl<'a> !RefUnwindSafe for LiftToSpvPtrs<'a>

§

impl<'a> !Send for LiftToSpvPtrs<'a>

§

impl<'a> !Sync for LiftToSpvPtrs<'a>

§

impl<'a> Unpin for LiftToSpvPtrs<'a>

§

impl<'a> !UnwindSafe for LiftToSpvPtrs<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.