This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Optimizations and gcc
- From: Jim Wilson <wilson at redhat dot com>
- To: "Scott Robert Ladd" <scott at coyotegulch dot com>
- Cc: "Gcc at Gnu dot Org" <gcc at gnu dot org>
- Date: 09 May 2002 13:45:21 -0400
- Subject: Re: Optimizations and gcc
- References: <FKEAJLBKJCGBDJJIPJLJMEOKCFAA.scott@coyotegulch.com>
>Short of digging through the gcc source code, I wonder if anyone has
>catalogued what, precisely, is implied by -O1, -O2, and -O3. If no one has,
>I'll endeavour to undertake this task myself, at least for Intel 32-bit
>systems.
You can get an accurate list for a particular target by compiling with
-fverbose-asm -S and then looking at the comments in the .s file.
This list may vary from one target to the next.
This sequence of commands:
touch tmp.c
gcc -O2 -fverbose-asm -S tmp.c
grep '#' tmp.s
gives this result on my machine:
# GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-98) (i386-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-98).
# options passed: -O2 -fverbose-asm
# options enabled: -fdefer-pop -foptimize-sibling-calls -fcse-follow-jumps
# -fcse-skip-blocks -fexpensive-optimizations -fthread-jumps
# -fstrength-reduce -fpeephole -fforce-mem -ffunction-cse -finline
# -fkeep-static-consts -fcaller-saves -fpcc-struct-return -fgcse
# -frerun-cse-after-loop -frerun-loop-opt -fdelete-null-pointer-checks
# -fschedule-insns2 -fsched-interblock -fsched-spec -fbranch-count-reg
# -fnew-exceptions -fcommon -fverbose-asm -fgnu-linker -fregmove
# -foptimize-register-move -fargument-alias -fstrict-aliasing
# -fmerge-constants -fident -fpeephole2 -fmath-errno -m80387 -mhard-float
# -mno-soft-float -mieee-fp -mfp-ret-in-387
Jim