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]

Re: Unomitted frame pointers


Sam Lauber wrote:

Sam, you really don't have the basic knowledge here. You really need to understand
ABI's in general, and the x86 ABI in particular, or you are not going to understand
what is going on.

-fomit-frame-pointer means omit the frame pointer when it is possible. It often
is not possible, in which case the switch is ignored. For example, it obviously
cannot be omitted if there is an alloca call.

because there is not enough information and documentation

You need to track down the information, you really can't expect to understand much until you do understand the ABI.

Why does it have to dynamically align the frame pointer?

Because this is required by the ABI, if you fail to align the stack pointer, then a lot of code will be unnecessarily ineffcient, and code using newer instructions (e.g. the new floating-point instructions) will fail at run time.

I find your comment a bit insulting

That's actually almost an amusing misunderstanding. Eric did not say that your machine was obsolete. He said that the generated code was accomodating an antiquated ABI. That's totally and completely different. He was not blaming you for anything!

The issue is that the original ABI did not forsee architecture developments.
For example, those requiring greater stack alignment. This is indeed quite
a mess, since you really need this greater alignment. What is happening is
that there are really two ABI's, the old antiquated one, maintained because
old software never dies, and the new one which accomodates the new instructions.
The main procedure in gcc is where the bridge is built between these two ABI's,
which is why the tack has to be dynamically aligned in main.

I assume you do understand alignment requirements in general. If not, you
will really be at sea here. I would recommend reading a book on architecture.

begin shameless plug:
My book "Microprocessors: A Programmers View", with Matthew Smosna, would
probably be at just the right level. It's out of print now, but Amazon lists
used copies from $1.98. [so I am not hunting for royalties here :-)]. One of
these days I should make an updated version of this book.
end shamless plug.


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