public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: Turn on -fomit-frame-pointer by default for 32bit Linux/x86
@ 2010-07-26 16:41 H.J. Lu
  2010-08-02 17:55 ` H.J. Lu
  0 siblings, 1 reply; 78+ messages in thread
From: H.J. Lu @ 2010-07-26 16:41 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Andrew Pinski, GCC Patches, Uros Bizjak

[-- Attachment #1: Type: text/plain, Size: 2884 bytes --]

On Wed, Jul 14, 2010 at 2:55 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Jul 14, 2010 at 6:46 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Wed, Jul 14, 2010 at 1:09 AM, Richard Guenther
>> <richard.guenther@gmail.com> wrote:
>>> On Tue, Jul 13, 2010 at 11:44 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Tue, Jul 13, 2010 at 2:02 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>>> On Tue, Jul 13, 2010 at 2:01 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>>>> On Tue, Jul 13, 2010 at 1:59 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>>> What will stop working when -fomit-frame-pointer is on?
>>>>>>
>>>>>> backtraces when debugging information is not turned on.
>>>>>
>>>>> See http://gcc.gnu.org/ml/gcc-patches/2004-08/msg01033.html and many
>>>>> more.  This is not the first time this has been discussed.
>>>>
>>>> Most of 32bit x86 assembly codes in glibc have .eh_frame section.
>>>> If backtrace is absolutely needed, they can add -fasynchronous-unwind-tables
>>>> or -fno-omit-frame-pointer.
>>>
>>> We build opensuse with -fomit-frame-pointer -fasynchronous-unwind-tables.
>>> If you want to make -fomit-frame-pointer the default then you should enable
>>> unwind tables by default.
>>>
>>
>> I will try and make it target/OS dependent.
>>
>
> Here is a patch. How does it look?
>

Here are the updated patch and spread sheet for SPEC CPU 2000/2006 on
Intel Core i7 which shows that -fomit-frame-pointer -fasynchronous-unwind-tables
improves performance by up to 12% at -O2 and 8% at -O3. For -Os, it improves
performance by up to 20%, but also increases code by up to 36%.

This patch turns on -fomit-frame-pointer -fasynchronous-unwind-tables only if
-Os isn't used.

Tested on Linux/ia32 and Linux/x86-64 with -m32. OK for trunk?

Thanks.

-- 
H.J.
---
gcc/

2010-07-25  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/i386.c (override_options): For 32bit, default
	flag_omit_frame_pointer and flag_asynchronous_unwind_tables
	to TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT and
	TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT.

	* config/i386/i386.h (TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT):
	New.
	(TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT): Likewise.
	* config/i386/linux.h (TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT):
	Likewise.
	(TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT): Likewise.
	* config/i386/linux64.h (TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT):
	Likewise.
	(TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT): Likewise.

gcc/testsuite/

2010-07-25  H.J. Lu  <hongjiu.lu@intel.com>

	* gcc.target/i386/frame-pointer-1.c: New.
	* gcc.target/i386/frame-pointer-2.c: Likewise.
	* gcc.target/i386/frame-pointer-3.c: Likewise.
	* gcc.target/i386/frame-pointer-4.c: Likewise.
	* gcc.target/i386/frame-pointer-5.c: Likewise.

[-- Attachment #2: gcc-i386-fp-3.patch --]
[-- Type: text/plain, Size: 6781 bytes --]

gcc/

2010-07-25  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/i386.c (override_options): For 32bit, default
	flag_omit_frame_pointer and flag_asynchronous_unwind_tables
	to TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT and
	TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT.

	* config/i386/i386.h (TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT):
	New.
	(TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT): Likewise.
	* config/i386/linux.h (TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT):
	Likewise.
	(TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT): Likewise.
	* config/i386/linux64.h (TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT):
	Likewise.
	(TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT): Likewise.

gcc/testsuite/

2010-07-25  H.J. Lu  <hongjiu.lu@intel.com>

	* gcc.target/i386/frame-pointer-1.c: New.
	* gcc.target/i386/frame-pointer-2.c: Likewise.
	* gcc.target/i386/frame-pointer-3.c: Likewise.
	* gcc.target/i386/frame-pointer-4.c: Likewise.
	* gcc.target/i386/frame-pointer-5.c: Likewise.

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index dbb8949..640243e 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -2985,10 +2985,27 @@ override_options (bool main_args_p)
     {
       if (flag_zee == 2)
         flag_zee = 0;
+      /* Unwind info is not correct around the CFG unless either a
+	 frame pointer is present or -maccumulate-outgoing-args is
+	 set. When both -fasynchronous-unwind-tables and
+	 -fomit-frame-pointer are turned on by default, turn off
+	 both if -mno-accumulate-outgoing-args is used.  When
+	 optimizing for size, don't turn on -fomit-frame-pointer nor
+	 -fasynchronous-unwind-tables by default.  */
       if (flag_omit_frame_pointer == 2)
-	flag_omit_frame_pointer = 0;
+	flag_omit_frame_pointer
+	  = (!optimize_size
+	     && TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT
+	     && (!TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT
+		 || !(target_flags_explicit
+		      & MASK_ACCUMULATE_OUTGOING_ARGS)));
       if (flag_asynchronous_unwind_tables == 2)
-	flag_asynchronous_unwind_tables = 0;
+	flag_asynchronous_unwind_tables
+	  = (!optimize_size
+	     && TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT
+	     && (!TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT
+		 || !(target_flags_explicit
+		      & MASK_ACCUMULATE_OUTGOING_ARGS)));
       if (flag_pcc_struct_return == 2)
 	flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
     }
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index e153920..2bb6d3e 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -467,6 +467,8 @@ extern tree x86_mfence;
 /* Extra bits to force on w/ 32-bit mode.  */
 #define TARGET_SUBTARGET32_DEFAULT 0
 #define TARGET_SUBTARGET32_ISA_DEFAULT 0
+#define TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT 0
+#define TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT 0
 
 /* Extra bits to force on w/ 64-bit mode.  */
 #define TARGET_SUBTARGET64_DEFAULT 0
diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
index 81dfd1e..61d53b5 100644
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
@@ -219,3 +219,10 @@ along with GCC; see the file COPYING3.  If not see
 /* i386 glibc provides __stack_chk_guard in %gs:0x14.  */
 #define TARGET_THREAD_SSP_OFFSET	0x14
 #endif
+
+/* Turn on -fomit-frame-pointer and -fasynchronous-unwind-tables by
+   default.  */
+#undef TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT
+#define TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT 1
+#undef TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT
+#define TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT 1
diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
index 33b4dc9..5a02205 100644
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
@@ -123,3 +123,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    x86_64 glibc provides it in %fs:0x28.  */
 #define TARGET_THREAD_SSP_OFFSET	(TARGET_64BIT ? 0x28 : 0x14)
 #endif
+
+/* Turn on -fomit-frame-pointer and -fasynchronous-unwind-tables by
+   default.  */
+#undef TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT
+#define TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT 1
+#undef TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT
+#define TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT 1
diff --git a/gcc/testsuite/gcc.target/i386/frame-pointer-1.c b/gcc/testsuite/gcc.target/i386/frame-pointer-1.c
new file mode 100644
index 0000000..ed4bff6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/frame-pointer-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=i686" } */
+/* { dg-require-effective-target ilp32 } */
+
+void bar (int);
+
+void
+foo (void)
+{
+  bar (1);
+}
+
+/* { dg-final { scan-assembler-not "pushl\[\\t \]*%ebp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/frame-pointer-2.c b/gcc/testsuite/gcc.target/i386/frame-pointer-2.c
new file mode 100644
index 0000000..b951ff4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/frame-pointer-2.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=i686 -mno-accumulate-outgoing-args" } */
+/* { dg-require-effective-target ilp32 } */
+
+void bar (int);
+
+void
+foo (void)
+{
+  bar (1);
+}
+
+/* { dg-final { scan-assembler "pushl\[\\t \]*%ebp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/frame-pointer-3.c b/gcc/testsuite/gcc.target/i386/frame-pointer-3.c
new file mode 100644
index 0000000..7a1d4d1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/frame-pointer-3.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=i686 -mpush-args" } */
+/* { dg-require-effective-target ilp32 } */
+
+void bar (int);
+
+void
+foo (void)
+{
+  bar (1);
+}
+
+/* { dg-final { scan-assembler-not "pushl\[\\t \]*%ebp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/frame-pointer-4.c b/gcc/testsuite/gcc.target/i386/frame-pointer-4.c
new file mode 100644
index 0000000..330a9ce
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/frame-pointer-4.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=i686 -mpush-args -mno-accumulate-outgoing-args" } */
+/* { dg-require-effective-target ilp32 } */
+
+void bar (int);
+
+void
+foo (void)
+{
+  bar (1);
+}
+
+/* { dg-final { scan-assembler "pushl\[\\t \]*%ebp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/frame-pointer-5.c b/gcc/testsuite/gcc.target/i386/frame-pointer-5.c
new file mode 100644
index 0000000..11240a2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/frame-pointer-5.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -mtune=i686" } */
+/* { dg-require-effective-target ilp32 } */
+
+void bar (int);
+
+void
+foo (void)
+{
+  bar (1);
+}
+
+/* { dg-final { scan-assembler "pushl\[\\t \]*%ebp" } } */

[-- Attachment #3: gcc frame pointer.xlsx --]
[-- Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, Size: 53995 bytes --]

^ permalink raw reply	[flat|nested] 78+ messages in thread
* Re: PATCH: Turn on -fomit-frame-pointer by default for 32bit  Linux/x86
@ 2010-08-04 18:52 Paul Pluzhnikov
  2010-08-04 19:13 ` H.J. Lu
  0 siblings, 1 reply; 78+ messages in thread
From: Paul Pluzhnikov @ 2010-08-04 18:52 UTC (permalink / raw)
  To: gcc-patches; +Cc: H.J. Lu"

I do not have an opinion of whether -O2 should or should not omit frame
pointers, but ...

On Mon, 2 Aug 2010 10:54:59 -0700, H.J. Lu <hjl.tools@gmail.com> wrote:

> We definitely should help our users deal with this change.
> I only propose this for Linux/x86 where backstrace in glibc
> supports unwind table. We can show them how to use
> backstrace in glibc

Unfortunately, backtrace() in glibc is not currently (glibc-2.11) usable
for getting stack traces from places that developers at Google care about;
namely from within malloc and from signal handlers.

If this patch was to go in, we'll just have to add -fno-omit-frame-pointer
for our 32-bit compiles (we already do that for 64-bit ones).

I suspect that above two "use cases" (heap operations and signal handlers)
cover vast majority of users who record stack traces, and the "just use glibc
backtrace" advice will "just not work" for them.

I can provide details, but the executive summary is that in order to allow
backtraces from malloc and from signal handlers, we use libunwind, and
even then we've had to patch glibc in some unpleasant ways, which will
not be acceptable upstream, and which (I suspect) most other users can't
afford to do.  And even after all that patching our solution is not
(yet) robust enough for general use across Google fleet, so we are using
frame-based unwinder for now.

Cheers,
-- 
Paul Pluzhnikov

^ permalink raw reply	[flat|nested] 78+ messages in thread
* PATCH: Turn on -fomit-frame-pointer by default for 32bit Linux/x86
@ 2010-08-12 16:22 H.J. Lu
  2010-08-12 16:28 ` Richard Henderson
                   ` (2 more replies)
  0 siblings, 3 replies; 78+ messages in thread
From: H.J. Lu @ 2010-08-12 16:22 UTC (permalink / raw)
  To: Uros Bizjak, GCC Patches
  Cc: Richard Guenther, Jakub Jelinek, Mark Mitchell,
	Richard Henderson, jh, Andi Kleen, Andrew Haley, David Daney,
	Xinliang David Li, Chris Lattner

[-- Attachment #1: Type: text/plain, Size: 3479 bytes --]

On Tue, Aug 10, 2010 at 8:52 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Sun, Aug 8, 2010 at 7:56 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>> Hello!
>>
>> After recent discussions, I would like to propose a transition to
>> -fomit-frame-pointer for x86_32.
>>
>> The transition should be smooth as much as possible, should have
>> option to revert to old behaviour and still providing path for the
>> improvement. And we have learned something from cld issues, too
>> (cough, cough...).
>>
>> I support the idea to change x86_32 defaults w.r.t. frame pointer (and
>> unwind tables) to the same defaults as x86_64 has.
>>
>> The patch should also introduce --enable-frame-pointer configure
>> option (off by default) that would revert back to old x86_32
>> behaviour. So, if there are codes that depend on FP, their users (or
>> distributions) should either (re-)configure the compiler with
>> --enable-frame-pointer or they should use older compiler - 4.5.x will
>> still be supported for many years. OTOH, it looks that users don't
>> care that much whether backtraces on x86_64 are totally accurate, so
>> IMO the sky won't fall down if x86_32 misses some backtraces in the
>> same way. And as I have learned from the discussion, the problem is
>> fixable with some effort on the user's side, thus fixing both targets
>> in one shot.
>>
>> Of course, this change and the option to revert to the previous
>> behaviour should be announced and documented in GCC release notes for
>> 4.6.0.
>>
>> IMO, we have to bite the bullet from time to time in order to improve
>> the generated code. We should not claim that gcc is
>> "no-code-left-behind compiler" - from my experience, introducing new
>> compiler always means that some parts of the code have to be fixed (as
>> in case of the change to -fno-strict-aliasing).
>>
>> Uros.
>>
>
> I tested this patch on Linux/ia32 and Linux/x86-64. There are no regressions.
>
> I don't have good wording for document:
>
> --
> For 32-bit x86 targets, it is not enabled at @option{-Os} by default.
> This option also can be disabled by default on 32-bit x86 targets by
> configuring GCC with the @option{--enable-frame-pointer} configure
> option.
> --
>
> isn't very accurate.  Any suggestions?
>
> Thanks.
>
>
> --
> H.J.
> ---
> 2010-08-09  H.J. Lu  <hongjiu.lu@intel.com>
>
>        * config.gcc: Handle --enable-frame-pointer.
>
>        * configure.ac: Add --enable-frame-pointer.
>        * configure: Regenerated.
>
>        * config/i386/i386.c (override_options): If not optimize for
>        size, use -fomit-frame-pointer and -fasynchronous-unwind-tables
>        by default for 32-bit code unless configured with
>        --enable-frame-pointer.
>

Here is the updated patch.  Any comments?

Thanks.

-- 
H.J.
--
2010-08-12  H.J. Lu  <hongjiu.lu@intel.com>
	    Uros Bizjak  <ubizjak@gmail.com>

	* config.gcc: Handle --enable-frame-pointer.

	* configure.ac: Add --enable-frame-pointer.
	* configure: Regenerated.

	* config/i386/i386.c (USE_IX86_FRAME_POINTER): Default to 0.
	(override_options): Enable -fomit-frame-pointer for 32bit code
	if compiling for TARGET_MACHO and not optimizing for size
	unless configured with --enable-frame-pointer.  Enable
	-fasynchronous-unwind-tables unless configured with
	--enable-frame-pointer.  Enable -maccumulate-outgoing-args
	by default unless configured with --enable-frame-pointer.

[-- Attachment #2: gcc-i386-fp-7.patch --]
[-- Type: text/plain, Size: 6724 bytes --]

2010-08-12  H.J. Lu  <hongjiu.lu@intel.com>
	    Uros Bizjak  <ubizjak@gmail.com>

	* config.gcc: Handle --enable-frame-pointer.

	* configure.ac: Add --enable-frame-pointer.
	* configure: Regenerated.

	* config/i386/i386.c (USE_IX86_FRAME_POINTER): Default to 0.
	(override_options): Enable -fomit-frame-pointer for 32bit code
	if compiling for TARGET_MACHO and not optimizing for size
	unless configured with --enable-frame-pointer.  Enable
	-fasynchronous-unwind-tables unless configured with
	--enable-frame-pointer.  Enable -maccumulate-outgoing-args
	by default unless configured with --enable-frame-pointer.

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 9170fc8..62dd9f6 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -406,6 +406,9 @@ i[34567]86-*-*)
 	if test "x$enable_cld" = xyes; then
 		tm_defines="${tm_defines} USE_IX86_CLD=1"
 	fi
+	if test "x$enable_frame_pointer" = xyes; then
+		tm_defines="${tm_defines} USE_IX86_FRAME_POINTER=1"
+	fi
 	tm_file="vxworks-dummy.h ${tm_file}"
 	;;
 x86_64-*-*)
@@ -413,6 +416,9 @@ x86_64-*-*)
 	if test "x$enable_cld" = xyes; then
 		tm_defines="${tm_defines} USE_IX86_CLD=1"
 	fi
+	if test "x$enable_frame_pointer" = xyes; then
+		tm_defines="${tm_defines} USE_IX86_FRAME_POINTER=1"
+	fi
 	tm_file="vxworks-dummy.h ${tm_file}"
 	;;
 esac
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index c3863ac..a87175c 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -2979,32 +2979,6 @@ override_options (bool main_args_p)
   if (TARGET_MACHO && TARGET_64BIT)
     flag_pic = 2;
 
-  /* Set the default values for switches whose default depends on TARGET_64BIT
-     in case they weren't overwritten by command line options.  */
-  if (TARGET_64BIT)
-    {
-      if (flag_zee == 2)
-        flag_zee = 1;
-      /* Mach-O doesn't support omitting the frame pointer for now.  */
-      if (flag_omit_frame_pointer == 2)
-	flag_omit_frame_pointer = (TARGET_MACHO ? 0 : 1);
-      if (flag_asynchronous_unwind_tables == 2)
-	flag_asynchronous_unwind_tables = 1;
-      if (flag_pcc_struct_return == 2)
-	flag_pcc_struct_return = 0;
-    }
-  else
-    {
-      if (flag_zee == 2)
-        flag_zee = 0;
-      if (flag_omit_frame_pointer == 2)
-	flag_omit_frame_pointer = 0;
-      if (flag_asynchronous_unwind_tables == 2)
-	flag_asynchronous_unwind_tables = 0;
-      if (flag_pcc_struct_return == 2)
-	flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
-    }
-
   /* Need to check -mtune=generic first.  */
   if (ix86_tune_string)
     {
@@ -3292,6 +3266,38 @@ override_options (bool main_args_p)
   for (i = 0; i < X86_TUNE_LAST; ++i)
     ix86_tune_features[i] = !!(initial_ix86_tune_features[i] & ix86_tune_mask);
 
+#ifndef USE_IX86_FRAME_POINTER
+#define USE_IX86_FRAME_POINTER 0
+#endif
+
+  /* Set the default values for switches whose default depends on TARGET_64BIT
+     in case they weren't overwritten by command line options.  */
+  if (TARGET_64BIT)
+    {
+      if (flag_zee == 2)
+        flag_zee = 1;
+      /* Mach-O doesn't support omitting the frame pointer for now.  */
+      if (flag_omit_frame_pointer == 2)
+	flag_omit_frame_pointer = (TARGET_MACHO ? 0 : 1);
+      if (flag_asynchronous_unwind_tables == 2)
+	flag_asynchronous_unwind_tables = 1;
+      if (flag_pcc_struct_return == 2)
+	flag_pcc_struct_return = 0;
+    }
+  else
+    {
+      if (flag_zee == 2)
+        flag_zee = 0;
+      /* Mach-O doesn't support omitting the frame pointer for now.  */
+      if (flag_omit_frame_pointer == 2)
+	flag_omit_frame_pointer =
+	  (TARGET_MACHO ? 0 : !(USE_IX86_FRAME_POINTER || optimize_size));
+      if (flag_asynchronous_unwind_tables == 2)
+	flag_asynchronous_unwind_tables = !USE_IX86_FRAME_POINTER;
+      if (flag_pcc_struct_return == 2)
+	flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
+    }
+
   if (optimize_size)
     ix86_cost = &ix86_size_cost;
   else
@@ -3574,7 +3580,8 @@ override_options (bool main_args_p)
 	       prefix, suffix, sw);
     }
 
-  if ((x86_accumulate_outgoing_args & ix86_tune_mask)
+  if ((!USE_IX86_FRAME_POINTER
+       || (x86_accumulate_outgoing_args & ix86_tune_mask))
       && !(target_flags_explicit & MASK_ACCUMULATE_OUTGOING_ARGS)
       && !optimize_size)
     target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS;
diff --git a/gcc/configure b/gcc/configure
index aa61cd6..ad548fc 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -898,6 +898,7 @@ with_system_libunwind
 enable_secureplt
 enable_leading_mingw64_underscores
 enable_cld
+enable_frame_pointer
 enable_win32_registry
 enable_static
 with_pic
@@ -1597,6 +1598,7 @@ Optional Features:
   --enable-leading-mingw64-underscores
                           Enable leading underscores on 64 bit mingw targets
   --enable-cld            enable -mcld by default for 32bit x86
+  --enable-frame-pointer  enable -fno-omit-frame-pointer by default for 32bit x86
   --disable-win32-registry
                           disable lookup of installation paths in the
                           Registry on Windows hosts
@@ -10708,6 +10710,24 @@ else
 fi
 
 
+# Check whether --enable-frame-pointer was given.
+if test "${enable_frame_pointer+set}" = set; then :
+  enableval=$enable_frame_pointer;
+else
+
+case $target_os in
+linux*)
+  # Enable -fomit-frame-pointer by default for Linux.
+  enable_frame_pointer=no
+  ;;
+*)
+  enable_frame_pointer=yes
+  ;;
+esac
+
+fi
+
+
 # Windows32 Registry support for specifying GCC installation paths.
 # Check whether --enable-win32-registry was given.
 if test "${enable_win32_registry+set}" = set; then :
@@ -17109,7 +17129,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17112 "configure"
+#line 17132 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17215,7 +17235,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17218 "configure"
+#line 17238 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 24d38aa..dd0b198 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1580,6 +1580,20 @@ AC_ARG_ENABLE(cld,
 [  --enable-cld            enable -mcld by default for 32bit x86], [],
 [enable_cld=no])
 
+AC_ARG_ENABLE(frame-pointer,
+[  --enable-frame-pointer  enable -fno-omit-frame-pointer by default for 32bit x86], [],
+[
+case $target_os in
+linux*)
+  # Enable -fomit-frame-pointer by default for Linux.
+  enable_frame_pointer=no
+  ;;
+*)
+  enable_frame_pointer=yes
+  ;;
+esac
+])
+
 # Windows32 Registry support for specifying GCC installation paths.
 AC_ARG_ENABLE(win32-registry,
 [  --disable-win32-registry

^ permalink raw reply	[flat|nested] 78+ messages in thread

end of thread, other threads:[~2013-01-30 21:52 UTC | newest]

Thread overview: 78+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-26 16:41 PATCH: Turn on -fomit-frame-pointer by default for 32bit Linux/x86 H.J. Lu
2010-08-02 17:55 ` H.J. Lu
2010-08-03  9:18   ` Uros Bizjak
2010-08-03  9:38     ` Andrew Haley
2010-08-03 14:03       ` H.J. Lu
2010-08-03 14:18         ` Daniel Jacobowitz
2010-08-03 14:28           ` H.J. Lu
2010-08-03 15:13             ` Daniel Jacobowitz
2010-08-03 15:35               ` H.J. Lu
2010-08-03 14:05     ` H.J. Lu
2010-08-03 14:11       ` Mark Mitchell
2010-08-03 17:12         ` Mark Mitchell
2010-08-03 17:24           ` Andrew Haley
2010-08-03 17:29             ` H.J. Lu
2010-08-03 17:57             ` Mark Mitchell
2010-08-04 13:21               ` Andrew Haley
2010-08-04 14:29                 ` Mark Mitchell
2010-08-04 14:44                   ` Andrew Haley
2010-08-04 14:48                   ` Bernd Schmidt
2010-08-04 15:00               ` Jan Hubicka
2010-08-04 15:54                 ` Andrew Haley
2010-08-04 16:08                 ` H.J. Lu
2010-08-04 16:23                   ` Andrew Haley
2010-08-04 17:05                     ` Andrew Haley
2010-08-04 17:06                       ` Andrew Haley
2010-08-04 17:08                         ` H.J. Lu
2010-08-09 12:07                           ` Mark Wielaard
2010-08-04 17:07                       ` H.J. Lu
2010-08-04 17:09                         ` Andrew Haley
2010-08-04 17:12                           ` H.J. Lu
2010-08-04 17:15                             ` Andrew Haley
2010-08-04 17:20                               ` H.J. Lu
2010-08-04 17:08                       ` Chris Lattner
2010-08-04 17:36                   ` Andi Kleen
2010-08-04 17:41                     ` H.J. Lu
2010-08-04 17:47                       ` Andrew Haley
2010-08-04 17:53                         ` H.J. Lu
2010-08-04 18:05                         ` Andi Kleen
2010-08-04 18:12                           ` Mark Mitchell
2010-08-04 18:18                             ` H.J. Lu
2010-08-17  1:47                     ` Maciej W. Rozycki
2010-08-03 17:58             ` David Daney
2010-08-03 17:25           ` H.J. Lu
2010-08-03 17:48             ` Mark Mitchell
2010-08-03 18:18           ` Richard Henderson
2010-08-04 18:52 Paul Pluzhnikov
2010-08-04 19:13 ` H.J. Lu
2010-08-04 19:24   ` Paul Pluzhnikov
2010-08-04 19:25   ` Xinliang David Li
2010-08-04 20:39   ` Andi Kleen
2010-08-04 20:57     ` David Daney
2010-08-04 21:09       ` Paul Pluzhnikov
2010-08-04 21:16         ` Andi Kleen
2010-08-04 22:07           ` Paul Pluzhnikov
2010-08-04 22:16             ` Andi Kleen
2010-08-04 22:45             ` David Daney
2010-08-05  7:00               ` Andi Kleen
2010-08-04 23:11         ` Richard Henderson
2010-08-05  7:23           ` Andi Kleen
2010-08-04 21:13       ` Andi Kleen
2010-08-12 16:22 H.J. Lu
2010-08-12 16:28 ` Richard Henderson
2010-08-12 16:35 ` Uros Bizjak
2010-08-12 16:52   ` H.J. Lu
2010-08-12 17:03     ` Uros Bizjak
2010-08-12 17:07       ` H.J. Lu
2010-08-12 17:12         ` H.J. Lu
2010-08-12 17:13           ` Uros Bizjak
2010-08-12 17:20             ` H.J. Lu
2010-08-12 17:26         ` Jack Howarth
2010-08-12 17:39           ` Uros Bizjak
2010-08-12 17:39             ` Jack Howarth
2010-08-12 17:46               ` Richard Henderson
2010-08-12 17:58                 ` IainS
2010-08-12 18:22                   ` Richard Henderson
2010-08-12 17:50               ` Uros Bizjak
2010-08-12 23:02               ` Mike Stump
2013-01-30 22:24 ` Ryan Hill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).