This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Set default to -fomit-frame-pointer
- From: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- To: Sandra Loosemore <sandra at codesourcery dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: nd <nd at arm dot com>
- Date: Wed, 15 Nov 2017 17:38:16 +0000
- Subject: Re: [PATCH] Set default to -fomit-frame-pointer
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Wilco dot Dijkstra at arm dot com;
- Nodisclaimer: True
- References: <DB6PR0801MB2053AA4635AFA1F43ED4C8F2835D0@DB6PR0801MB2053.eurprd08.prod.outlook.com>,<59FCC04C.3060605@codesourcery.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Sandra Loosemore wrote:
> I'd prefer that you remove the reference to configure options entirely
> here. Nowadays most GCC users install a package provided by their OS
> distribution, Linaro, etc, rather than trying to build GCC from scratch.
OK, I've removed that reference. Similarly the FRAME_POINTER_REQUIRED
bit as that statement is not only irrelevant but also completely incorrect.
> > +Enabled at levels @option{-O}, @option{-O1}, @option{-O2}, @option{-O3},
> > +@option{-Os} and @option{-Og}.
>
> This last sentence makes no sense. If the option is now enabled by
> default, then the optimization level is irrelevant.
It's enabled from -O onwards, so I've changed it to the standard form used
elsewhere and updated the table for -O:
+Enabled by default at @option{-O} and higher.
Here is the cleaned up and simplified version:
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 2ef88e081f982f5619132cc33ce23c3fb542ae11..158c9ae3f1297a1265fc974cd3e6825d8f5be096 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -7258,6 +7258,7 @@ compilation time.
-fipa-reference @gol
-fmerge-constants @gol
-fmove-loop-invariants @gol
+-fomit-frame-pointer @gol
-freorder-blocks @gol
-fshrink-wrap @gol
-fshrink-wrap-separate @gol
@@ -7282,9 +7283,6 @@ compilation time.
-ftree-ter @gol
-funit-at-a-time}
-@option{-O} also turns on @option{-fomit-frame-pointer} on machines
-where doing so does not interfere with debugging.
-
@item -O2
@opindex O2
Optimize even more. GCC performs nearly all supported optimizations
@@ -7436,29 +7434,18 @@ The default is @option{-ffp-contract=fast}.
@item -fomit-frame-pointer
@opindex fomit-frame-pointer
-Don't keep the frame pointer in a register for functions that
-don't need one. This avoids the instructions to save, set up and
-restore frame pointers; it also makes an extra register available
-in many functions. @strong{It also makes debugging impossible on
-some machines.}
-
-On some machines, such as the VAX, this flag has no effect, because
-the standard calling sequence automatically handles the frame pointer
-and nothing is saved by pretending it doesn't exist. The
-machine-description macro @code{FRAME_POINTER_REQUIRED} controls
-whether a target machine supports this flag. @xref{Registers,,Register
-Usage, gccint, GNU Compiler Collection (GCC) Internals}.
-
-The default setting (when not optimizing for
-size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
-@option{-fomit-frame-pointer}. You can configure GCC with the
-@option{--enable-frame-pointer} configure option to change the default.
-
-Note that @option{-fno-omit-frame-pointer} doesn't force a new stack
-frame for all functions if it isn't otherwise needed, and hence doesn't
-guarantee a new frame pointer for all functions.
+Omit the frame pointer in functions that don't need one. This avoids the
+instructions to save, set up and restore the frame pointer; on many targets
+it also makes an extra register available.
-Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+On some targets this flag has no effect because the standard calling sequence
+always uses a frame pointer, so it cannot be omitted.
+
+Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
+is used in all functions. Several targets always omit the frame pointer in
+leaf functions.
+
+Enabled by default at @option{-O} and higher.
@item -foptimize-sibling-calls
@opindex foptimize-sibling-calls
@@ -16753,9 +16740,7 @@ Certain other options, such as @option{-mid-shared-library} and
@opindex momit-leaf-frame-pointer
Don't keep the frame pointer in a register for leaf functions. This
avoids the instructions to save, set up and restore frame pointers and
-makes an extra register available in leaf functions. The option
-@option{-fomit-frame-pointer} removes the frame pointer for all functions,
-which might make debugging harder.
+makes an extra register available in leaf functions.
@item -mspecld-anomaly
@opindex mspecld-anomaly