ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.