Monday, April 17, 2006

gcc - Optimization chart


Here is a list of what optimizations are in effect at the different -Ox levels (from an article on the linux journal);

gcc - Understanding source and assembly

It is often nice to have source code interspersed with the generated assembly so that we can better understand the optimizations in effect. Here is something i picked up from an article on the linux journal;

gcc -c -g -Wa,-ahl,-L test.c

This command uses the GNU assembler to emit the listing. The -Wa option is used to pass the -ahl and -L options to the assembler to emit a listing to standard-out that contains the high-level source and assembly. The -L option retains the local symbols in the symbol table.