Date: Thu, 4 Dec 1997 17:24:49 -0800 (PST) Message-Id: <199712050124.RAA26234@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: Speed , djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: optimization question Precedence: bulk At 07:17 12/2/1997 -0800, Speed wrote: >I was curious about using the -fomit-frame-pointer switch. What exactly >is the effect of this? All I've read is that it makes an extra register >available for use, and I didn't see much mention of it in the faq. Normally, a function compiled with GCC copies the stack pointer (esp) into the frame pointer (ebp) on entry. Then it accesses its parameters and local variables relative to the frame pointer. This scheme is called a stack frame. `-fomit-frame-pointer' causes it to access them relative to the stack pointer instead. This allows the compiler to use ebp as another general register, and also avoids the overhead of moving it to and from esp. However, debuggers expect to see a standard stack frame, and will have trouble when it isn't there. The usual practice is to use it only on programs which don't need to be debugged (if there is such a thing :) > >When I compile with that switch, it causes problems with alot of my >functions that use inline assembly. Is there something I need to >preserve (push/pop) in order to make this work? If your inline asm accesses local variables relative to ebp, that would break. You should use the extended asm features to have GCC figure out their addresses for you (info gcc "c extensions" "extended asm"). Another possibility is that you are clobbering some register and not telling the compiler, and you just got lucky before. Nate Eldredge eldredge AT ap DOT net