(
&mut self,
callee_ty: Self::Type,
_fn_attrs: Option<&CodegenFnAttrs>,
_fn_abi: Option<&FnAbi<'tcx, Ty<'tcx>>>,
callee: Self::Value,
args: &[Self::Valu
| 2344 | } |
| 2345 | |
| 2346 | fn call( |
| 2347 | &mut self, |
| 2348 | callee_ty: Self::Type, |
| 2349 | _fn_attrs: Option<&CodegenFnAttrs>, |
| 2350 | _fn_abi: Option<&FnAbi<'tcx, Ty<'tcx>>>, |
| 2351 | callee: Self::Value, |
| 2352 | args: &[Self::Value], |
| 2353 | funclet: Option<&Self::Funclet>, |
| 2354 | ) -> Self::Value { |
| 2355 | if funclet.is_some() { |
| 2356 | self.fatal("TODO: Funclets are not supported"); |
| 2357 | } |
| 2358 | |
| 2359 | // NOTE(eddyb) see the comment on `SpirvValueKind::FnAddr`, this should |
| 2360 | // be fixed upstream, so we never see any "function pointer" values being |
| 2361 | // created just to perform direct calls. |
| 2362 | let (callee_val, result_type, argument_types) = match self.lookup_type(callee.ty) { |
| 2363 | // HACK(eddyb) this seems to be needed, but it's not what `get_fn_addr` |
| 2364 | // produces, are these coming from inside `rustc_codegen_spirv`? |
| 2365 | SpirvType::Function { |
| 2366 | return_type, |
| 2367 | arguments, |
| 2368 | } => { |
| 2369 | assert_ty_eq!(self, callee_ty, callee.ty); |
| 2370 | (callee.def(self), return_type, arguments) |
| 2371 | } |
| 2372 | |
| 2373 | SpirvType::Pointer { pointee } => match self.lookup_type(pointee) { |
| 2374 | SpirvType::Function { |
| 2375 | return_type, |
| 2376 | arguments, |
| 2377 | } => ( |
| 2378 | if let SpirvValueKind::FnAddr { function } = callee.kind { |
| 2379 | assert_ty_eq!(self, callee_ty, pointee); |
| 2380 | function |
| 2381 | } |
| 2382 | // Truly indirect call. |
| 2383 | else { |
| 2384 | let fn_ptr_val = callee.def(self); |
| 2385 | self.zombie(fn_ptr_val, "indirect calls are not supported in SPIR-V"); |
| 2386 | fn_ptr_val |
| 2387 | }, |
| 2388 | return_type, |
| 2389 | arguments, |
| 2390 | ), |
| 2391 | _ => bug!( |
| 2392 | "call expected `fn` pointer to point to function type, got `{}`", |
| 2393 | self.debug_type(pointee) |
| 2394 | ), |
| 2395 | }, |
| 2396 | |
| 2397 | _ => bug!( |
| 2398 | "call expected function or `fn` pointer type, got `{}`", |
| 2399 | self.debug_type(callee.ty) |
| 2400 | ), |
| 2401 | }; |
| 2402 | |
| 2403 | for (argument, &argument_type) in args.iter().zip(argument_types) { |
no test coverage detected