This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Optimizations and gcc


>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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]