IIRC tcc, Bellard's tiny c compiler, works this way. It emits very naive native code, but it chomps source code fast enough to boot linux 2.4 from source under 10 seconds years ago.
For initialized arrays with unknown size, a first pass is done to count the number of elements.
For architectures where arguments are evaluated in reverse order, a first pass is done to reverse the argument order.
From: http://bellard.org/tcc/tcc-doc.htmlThis great code to read. I need to get back to playing with it again.
ps: it's also still under development http://lists.nongnu.org/archive/html/tinycc-devel/ .. impressive.
----
"tcc still compiles around 10x faster but runs x3.5 times slower." from tcc homepage 3rd benchmark URL http://lists.nongnu.org/archive/html/tinycc-devel/2013-02/ms...
tcc can actually be made to build Windows executables in the 'old-school' "Programming Windows" way, which is quite fun.