1

Is there any book or articles related to how C/C++ code is converted to assembly language, I mean common patterns for a specific compiler, etc?

2 Answers 2

2

I believe the best thing to do would be to learn about compilation in general and code generation in particular. The dragon book would be a good start. Then you can check Engineering a Compiler by Cooper & co.

About common compiler patterns, this would require a bit of extensive reverse engineering which, I believe, few people in the research and industrial community are ready to do/share. But, there's a guy named Agner Fog who does an extensive amount of benchmarking and analyzes the relationship of a compiler/code pattern with the underlying hardware architecture in terms of optimization. You can find his work here. What would be of interest to you is the Optimizing software in C++: An optimization guide for Windows, Linux and Mac platforms. It's simply a gold mine. Next, I would recommend : Optimizing subroutines in assembly language: An optimization guide for x86 platforms.

1

Yes, there is a very good book (as in, it covers tons of patterns) at https://beginners.re/ - https://beginners.re/RE4B-EN.pdf

You can spend 5-10 years studying general theory of compilation, which will go forward during that time anyway, but if you need a reasonably quick compendium of current patterns for reference / quick training, use that book.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.