Implementing stack frames/vaargs


After several months of procrastination I'm at the point where I'd like to implement vaargs in all the code generators that do not support it yet.

As a little background, I'm putting together a version of newlib, startup code, linker command files, soft-flt (if needed), and compiler-rt that I'm building for the llvm targets supported by qemu. I build programs and run them in qemu user mode. So far, X86 and ARM work out of the box. powerpc and sparc work as long as I don't do anything using vaargs (no printf :-(). Alpha compiles but I haven't implemented the low level system calls yet so I can't verify that it works.

My question is this: which backend would be the best to model changes for vaargs after? Which is the most up-to-date? Is there documentation somewhere that describes how stack frames and vaargs should be done?