[LLVMdev] -fomit-frame-pointer on intel darwin
Jack Howarth
howarth at bromo.med.uc.edu
Mon Aug 16 07:59:36 PDT 2010
Can anyone shed some light on the origins of the comments...
/* Mach-O doesn't support omitting the frame pointer for now. */
...in gcc/config/i386/i386.c. FSF gcc trunk has enabled the
omit-frame-pointer option as the default for both i386 and x86_64
recently.
* 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.
After testing on x86_64-appled-darwin10 and i386-apple-darwin10, I
had the same enabled on darwin releases which default to dwarf2
now in FSF gcc trunk using...
--- trunk/gcc/configure.ac 2010/08/13 15:50:40 163226
+++ trunk/gcc/configure.ac 2010/08/13 17:06:42 163227
@@ -1584,8 +1584,9 @@
[ --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.
+linux* | darwin[[8912]]*)
+ # Enable -fomit-frame-pointer by default for Linux and Darwin with
+ # DWARF2.
enable_frame_pointer=no
;;
*)
--- trunk/gcc/config/i386/i386.c 2010/08/13 15:50:40 163226
+++ trunk/gcc/config/i386/i386.c 2010/08/13 17:06:42 163227
@@ -3276,9 +3276,8 @@
{
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);
+ flag_omit_frame_pointer = 1;
if (flag_asynchronous_unwind_tables == 2)
flag_asynchronous_unwind_tables = 1;
if (flag_pcc_struct_return == 2)
@@ -3288,10 +3287,8 @@
{
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));
+ flag_omit_frame_pointer = !(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)
Despite the absence of testsuite failures at -m32 or -m64 on either
i386-apple-darwin10 or x86_64-apple-darwin10, there are still some concerns
about the origins of the original Mach-O comment above. There also was
a concern that -fomit-frame-pointer would break Shark but my testing in
darwin10 suggests it still can profile code via the dwarf2. Thanks in
advance for any clarifications on the reasoning behind the original code.
Jack
More information about the llvm-dev
mailing list