delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/05/07:45:21

Message-ID: <34878B7A.5D1E@mailexcite.com>
Date: Fri, 05 Dec 1997 00:04:58 -0500
From: Doug Gale <dgale AT mailexcite DOT com>
Reply-To: dgale AT mailexcite DOT com
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: optimization question
References: <3484CF43 DOT 136E7339 AT remove-this DOT linux DOT dpilink DOT com>
NNTP-Posting-Host: embernet31.idirect.com
Lines: 30
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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.
> 
> 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?
> 
> Thanks.

-fomit-frame-pointer improves code quality in two ways. Number one, the
compiler does not set up ebp to point to locals and parameters - it
keeps track of the stack pointer and accesses that stuff using esp.
Number two, because the compiler does not use ebp for a stack pointer,
it can use it as a general register, therefore opening up more register
optimization possibilities.

However, there are two major disadvantages to using this switch while
working on the program. Number one, you can't view your local variables
in RHIDE (assuming you use it). Number two, if/when your program causes
an exception (SIGSEGV, or whatever), it cannot do a stack trace (show
list of calls up to the exception), and RHIDE's stack trace (call stack)
does not (and cannot) work either. Reserve this switch to finished,
working code.

About your assembly: are you using AT&T extended asm? Maybe you are
specifying specific use of ebp for your local variable and parameter
access, when ebp is being used for other purposes. Post a snipped of the
failing function.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019