struct LiftToSpvPtrInstsInFunc<'a> {
    lifter: &'a LiftToSpvPtrs<'a>,
    global_vars: &'a EntityDefs<GlobalVar>,
    deferred_ptr_noops: IndexMap<DataInst, DeferredPtrNoop, BuildHasherDefault<FxHasher>>,
    data_inst_use_counts: EntityOrientedDenseMap<DataInst, NonZeroU32>,
    func_has_qptr_analysis_bug_diags: bool,
}

Fields§

§lifter: &'a LiftToSpvPtrs<'a>§global_vars: &'a EntityDefs<GlobalVar>§deferred_ptr_noops: IndexMap<DataInst, DeferredPtrNoop, BuildHasherDefault<FxHasher>>

Some QPtr->QPtr QPtrOps must be noops in SPIR-V, but because some of them have meaningful semantic differences in SPIR-T, replacement of their uses must be deferred until after try_lift_data_inst_def has had a chance to observe the distinction.

E.g. QPtrOp::BufferDatas cannot adjust the SPIR-V pointer type, due to interactions between the Block annotation and any potential trailing OpTypeRuntimeArrays (which cannot be nested in non-Block structs).

The QPtrOp itself is only removed after the entire function is lifted, (using data_inst_use_counts to determine whether they’re truly unused).

§data_inst_use_counts: EntityOrientedDenseMap<DataInst, NonZeroU32>§func_has_qptr_analysis_bug_diags: bool

Implementations§

source§

impl LiftToSpvPtrInstsInFunc<'_>

source

fn try_lift_data_inst_def( &mut self, func_at_data_inst: FuncAtMut<'_, DataInst>, parent_block: ControlNode ) -> Result<Transformed<DataInstDef>, LiftError>

source

fn maybe_adjust_pointer_for_access( &self, ptr: Value, addr_space: AddrSpace, pointee_layout: TypeLayout, access_type: Type ) -> Result<Option<DataInstDef>, LiftError>

If necessary, construct an OpAccessChain instruction to turn ptr (pointing to a type with pointee_layout) into a pointer to access_type (which can then be used with e.g. OpLoad/OpStore).

source

fn resolve_deferred_ptr_noop_uses(&self, values: &mut [Value])

Apply rewrites implied by deferred_ptr_noops to values.

This does not update data_inst_use_counts - in order to do that, you must call self.remove_value_uses(values) beforehand, and then also call self.after_value_uses(values) afterwards.

source

fn add_value_uses(&mut self, values: &[Value])

source

fn remove_value_uses(&mut self, values: &[Value])

Trait Implementations§

source§

impl Transformer for LiftToSpvPtrInstsInFunc<'_>

source§

fn transform_const_use(&mut self, ct: Const) -> Transformed<Const>

source§

fn transform_value_use(&mut self, v: &Value) -> Transformed<Value>

source§

fn in_place_transform_control_node_def( &mut self, func_at_control_node: FuncAtMut<'_, ControlNode> )

source§

fn in_place_transform_func_decl(&mut self, func_decl: &mut FuncDecl)

source§

fn transform_attr_set_use(&mut self, _attrs: AttrSet) -> Transformed<AttrSet>

source§

fn transform_type_use(&mut self, _ty: Type) -> Transformed<Type>

source§

fn transform_data_inst_form_use( &mut self, _data_inst_form: DataInstForm ) -> Transformed<DataInstForm>

source§

fn transform_global_var_use(&mut self, _gv: GlobalVar) -> Transformed<GlobalVar>

source§

fn transform_func_use(&mut self, _func: Func) -> Transformed<Func>

source§

fn in_place_transform_spv_dialect(&mut self, _dialect: &mut Dialect)

source§

fn in_place_transform_spv_module_debug_info( &mut self, _debug_info: &mut ModuleDebugInfo )

source§

fn transform_attr_set_def( &mut self, attrs_def: &AttrSetDef ) -> Transformed<AttrSetDef>

source§

fn transform_attr(&mut self, attr: &Attr) -> Transformed<Attr>

source§

fn transform_type_def(&mut self, ty_def: &TypeDef) -> Transformed<TypeDef>

source§

fn transform_const_def(&mut self, ct_def: &ConstDef) -> Transformed<ConstDef>

source§

fn transform_data_inst_form_def( &mut self, data_inst_form_def: &DataInstFormDef ) -> Transformed<DataInstFormDef>

source§

fn in_place_transform_module(&mut self, module: &mut Module)

source§

fn in_place_transform_module_dialect(&mut self, dialect: &mut ModuleDialect)

source§

fn in_place_transform_module_debug_info( &mut self, debug_info: &mut ModuleDebugInfo )

source§

fn in_place_transform_global_var_decl(&mut self, gv_decl: &mut GlobalVarDecl)

source§

fn in_place_transform_data_inst_def( &mut self, func_at_data_inst: FuncAtMut<'_, DataInst> )

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.