Custom Calling Conventions in a Portable Assembly Language
Calling conventions are so difficult to implement
and maintain that people rarely experiment with alternatives.
The primary sources of difficulty appear to be parameter passing and
stack-frame layout.
To implement parameter passing, we use the automata developed by
Bailey and Davidson, but we have developed a new specification
language that is implementable directly in the compiler.
To implement stack-frame layout, we have developed an applicative,
composable abstraction that cleanly decouples the layout of the stack frame
from the order in which compiler phases execute.
We hope these abstractions will so simplify the implementation problem
that compiler writers will routinely customize calling
conventions to improve performance.
Full paper
The paper is available as
US Letter PostScript (263K),
US Letter PDF (197K),
and
US Letter TeX DVI (94K).