]> git.proxmox.com Git - rustc.git/blame - src/librustc_target/abi/call/wasm32_bindgen_compat.rs
New upstream version 1.42.0+dfsg1
[rustc.git] / src / librustc_target / abi / call / wasm32_bindgen_compat.rs
CommitLineData
e74abb32
XL
1// This is not and has never been a correct C ABI for WebAssembly, but
2// for a long time this was the C ABI that Rust used. wasm-bindgen
3// depends on ABI details for this ABI and is incompatible with the
4// correct C ABI, so this ABI is being kept around until wasm-bindgen
5// can be fixed to work with the correct ABI. See #63649 for further
6// discussion.
7
dfeec247 8use crate::abi::call::{ArgAbi, FnAbi};
e74abb32 9
60c5eb7d 10fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
e74abb32
XL
11 ret.extend_integer_width_to(32);
12}
13
60c5eb7d 14fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
e74abb32
XL
15 arg.extend_integer_width_to(32);
16}
17
60c5eb7d
XL
18pub fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
19 if !fn_abi.ret.is_ignore() {
20 classify_ret(&mut fn_abi.ret);
e74abb32
XL
21 }
22
60c5eb7d 23 for arg in &mut fn_abi.args {
dfeec247
XL
24 if arg.is_ignore() {
25 continue;
26 }
60c5eb7d 27 classify_arg(arg);
e74abb32
XL
28 }
29}