optimizing c
hello, im currently writing a program in c and i would really like to know what optimizations gcc preforms on my code. if possible can you still see the code with the optimizations before the compiler turns it to machine code or, even better, before it turns it to assembly. thanks a lot
|
Check out all the -f options in "man gcc". The optimization levels are really just pre-defined combinations of those -f options. For assembly output use -S.
|
i want to use the -O3 option but see what that does to me c code really or anything close to that, i.e. see my code optimized by the compiler. thanks anyhow
|
As tuxdev says: use the -S option to see the assembler output. Compare the output with and without the -O3 option.
|
cheers thats probably enough for me to solve the problem. just one more thing on this matter: is there anything between the preprocessed c and assembly? thanks
|
I heard that GCC parses all supported languages to RTL (Register Transfer Language), then optimizes that. There may be a way to get at it, but I don't really know that much about GCC internals.
|
The main reason why you do not see an "assembly listing" anymore is that there isn't a one-to-one correspondence between the code you write and the instruction-stream that is produced. They are functionally equivalent but they do not correspond.
|
All times are GMT -5. The time now is 08:21 PM. |