Sign in to follow this  
Winograd

GCC calling conventions

Recommended Posts

Hi! I was wondering if its possible to self define calling conventions with gcc for a given function. naked attribute does not work for i386. I need to get rid of the stack popping and pushing and the ret instruction at the end of some functions. Any ideas?

Share this post


Link to post
Share on other sites
You can specify -fomit-frame-pointer to remove stack frames (pushes and pops, it won't remove the ret) on functions that don't need them, other than that I can't think of a way unless you just inline the function or write it in assembly.

Share this post


Link to post
Share on other sites
Yep... I tried.. it only removes warnings. The ret instruction remains in the code on every optimization level. Atleast on gcc 3.3.2. I guess its HUGE and UGLY goto-full function then, or I just stick to assembly.

This may seem little unnecessary for you but i'm writing 4k intro and in my softsynth there is MANY "functions" that really have no need for ret... or for stack. And every instruction counts.

Is there any other language that would support custom calling conventions? Fortran? Some really low-level language, which could still provide portability.

Share this post


Link to post
Share on other sites
Sign in to follow this