GCC calling conventions
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?
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.
Ra
__attribute__(noreturn) (or similar, check the gcc documentation) tells the compiler the function won't return, so it might optimize out some ret's.
[Journal]
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement