This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Changing the ABI


Dear all,

I have a current issue on my port. Basically the stack is defined as follows :

1) CALL_USED save area
2) Local variables
3) Caller arguments passed on the stack
4) 8 words to save arguments passed in registers, even if not passed

Now, this was done because we have defined 8 output registers,
therefore zone (3) is not used except if we call a function with more
than 8 parameters.

(4) is only used if we have va_arg functions that will then spill the
8 input registers on the stack and call the va_arg function.

This is done, to my understanding for our ABI, because, in the case of
a va_arg function, we want the parameters consecutively store in
memory.

However, this brings me to 2 problems :

1) If there are no va_arg function calls, there still is 8 words
wasted on the stack per function call still active on the stack.

2) If there is an alloca, then GCC moves the stack pointer but without
trying to get back those 8 words or even the space for (3).


I am currently working on not having that wasted space. I see two options:

1) Change the ABI to go closer to what I have seen in the MIPS port :
    - The zone (4) is handled by the callee
    - However, I'll still have the wasted space (4) when an alloca is used no ?

2) Figure out how to explain to GCC how to reclaim zones (3), (4)
before an alloca and then, once the size of the alloca is known, add
to the stack new zones (3) and (4) for subsequent calls.
Of course, when the alloca-ed zone is freed, we will have to set back
the old zones (3) and (4).

Hopefully this email made some sense and some one will have an idea or
a direction I can look into,
Thanks again for all your time,
Jean Christophe Beyler


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]