Struct spirt::qptr::lift::LiftToSpvPtrInstsInFunc
source · 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
QPtrOp
s 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::BufferData
s cannot adjust the SPIR-V pointer type, due to
interactions between the Block
annotation and any potential trailing
OpTypeRuntimeArray
s (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<'_>
impl LiftToSpvPtrInstsInFunc<'_>
fn try_lift_data_inst_def( &mut self, func_at_data_inst: FuncAtMut<'_, DataInst>, parent_block: ControlNode ) -> Result<Transformed<DataInstDef>, LiftError>
sourcefn maybe_adjust_pointer_for_access(
&self,
ptr: Value,
addr_space: AddrSpace,
pointee_layout: TypeLayout,
access_type: Type
) -> Result<Option<DataInstDef>, LiftError>
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
).
sourcefn resolve_deferred_ptr_noop_uses(&self, values: &mut [Value])
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.