go-llvm / llgo

LLVM-based compiler for Go
Other
1.25k stars 81 forks source link

Implement ABI rule requiring stack parameter passing when out of registe... #193

Closed pcc closed 10 years ago

pcc commented 10 years ago

...rs

This implements the following rule (x86-64 ABI, section 3.2.3, "Passing"): "If there are no registers available for any eightbyte of an argument, the whole argument is passed on the stack."

We keep track of the number of registers allocated so far and use the indirect parameter passing convention for parameters occupying more than one register if we are out of registers. If the parameter uses a single register, we can still use the direct convention because the code generator will pass the parameter on the stack anyway, and it normally gives us simpler IR.

axw commented 10 years ago

LGTM