make gcc pass the arguments by register
c, gcc, linux
Solution
The relevant attribute is `__attribute__((fastcall))`. Functions declared with this attribute are called with their first eligible argument in ECX and the second in EDX.
(I'm assuming x86. You just said 32 bits, but that covers many architectures such as ARM).
Problem
On my 32bit x86 Ubuntu11.10, gcc4.6.3 pass the arguments by stack. Is there any gcc optimization that force gcc to pass arguments by registers? And how gcc do that? I want some details, please.