The author criticizes the traditional C ABI for passing complex types inefficiently and points to the Go register ABI as a better solution. The article delves into calling conventions, with a focus on x86, proposing a new calling convention for Rust functions that prioritizes performance. By introducing the -Zcallconv flag, Rust could generate significantly better code by optimizing how arguments are passed and returned. The proposal involves customizing LLVM IR functions to maximize register usage and minimize stack usage. The use of LLVM’s poison semantics allows for efficient argument passing even in cases where not all registers are needed. The strategy aims to improve code generation and performance in Rust functions.
https://mcyoung.xyz/2024/04/17/calling-convention/