You can set the GCC to dump its internal (Gimple, ...) representation , at different "stages". The middle end of GCC consists of hundreds of passes, and you can ask GCC to reset them with arguments , such as -fdump-tree-all or -fdump-gimple-all ; that you can get hundreds of dump files for one compilation!
However, the internal views of GCC are rather low, and you should not expect to understand them without reading a lot of material.
The dump options that I mention are mostly useful for those who work inside GCC, or extend it to plugins encoded in C or extensions encoded in MELT (a high-level domain language for the GCC extension). I'm not sure that they will be very useful for your friend. However, they can be useful for you to understand that optimization transitions do a lot of complex processing.
And do not forget that premature optimization is evil : you must first run your program correctly, and then check and profile it, and finally, optimize several advantages of your efforts. You probably wonβt be able to write the right and effective programs without testing and running them yourself before passing them on to your friend.
source share