Verifying compiler optimizations in gcc/g++ by analyzing assembly listings

前端 未结 8 1777
闹比i
闹比i 2021-02-04 09:00

I just asked a question related to how the compiler optimizes certain C++ code, and I was looking around SO for any questions about how to verify that the compiler has performed

8条回答
  •  执笔经年
    2021-02-04 09:19

    Zoom from RotateRight ( http://rotateright.com ) is mentioned in another answer, but to expand on that: it shows you the mapping of source to assembly in what they call the "code browser". It's incredibly handy even if you're not an asm expert because they have also integrated assembly documentation into the app. And the assembly listing is annotated with comments and timing for several CPU types.

    You can just open your object or executable file with Zoom and take a look at what the compiler has done with your code.

提交回复
热议问题