mirror of
https://github.com/ziglang/zig.git
synced 2025-12-28 09:03:21 +00:00
When lowering the return type for Wasm if the calling convention is `C`, it now correctly lower it according to what clang does as specified in: https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md This makes use of the same logic as the Wasm backend, ensuring the generated code does not diverge in function signatures. When passing arguments accross the C-ABI for the Wasm target, we want slightly different behavior than x86_64. For instance: a struct with multiple fields must always be passed by reference, even if its ABI size fits in a single integer. However, we do pass larger integers such as 128bit by value, which LLVM will correctly lower to use double arguments instead.