MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / get_fn_addr

Method get_fn_addr

crates/rustc_codegen_spirv/src/codegen_cx/mod.rs:784–803  ·  view source on GitHub ↗

NOTE(eddyb) see the comment on `SpirvValueKind::FnAddr`, this should be fixed upstream, so we never see any "function pointer" values being created just to perform direct calls.

(&self, instance: Instance<'tcx>)

Source from the content-addressed store, hash-verified

782 // be fixed upstream, so we never see any "function pointer" values being
783 // created just to perform direct calls.
784 fn get_fn_addr(&self, instance: Instance<'tcx>) -> Self::Value {
785 let function = self.get_fn(instance);
786 let span = self.tcx.def_span(instance.def_id());
787
788 let ty = SpirvType::Pointer {
789 pointee: function.ty,
790 }
791 .def(span, self);
792
793 // Create these `OpUndef`s up front, instead of on-demand in `SpirvValue::def`,
794 // because `SpirvValue::def` can't use `cx.emit()`.
795 self.def_constant(ty, SpirvConst::ZombieUndefForFnAddr);
796
797 SpirvValue {
798 kind: SpirvValueKind::FnAddr {
799 function: function.def_cx(self),
800 },
801 ty,
802 }
803 }
804
805 fn eh_personality(&self) -> Self::Value {
806 todo!()

Callers 1

scalar_to_backendMethod · 0.80

Calls 4

get_fnMethod · 0.80
def_constantMethod · 0.80
def_cxMethod · 0.80
defMethod · 0.45

Tested by

no test coverage detected