I am trying to optimize a lot of multiplications and pointer arithmetics and would like to see what the compiler does underneath when I put in optimization flags.
--Edit--
How to restrict it to a specific function or a code block?
--Edit_2--
How to let gcc generate a less verbose assembly-code?
Go to project properties, then to C++/Output Files and set Assembler Output setting and ASM list location to a file name. Show activity on this post. You have to provide the compiled object code as a parameter. Show activity on this post.
With gcc or g++ compiler, you can use the -S flag to see the assembly code generated.
GCC compiles to assembler. Some other compilers don't. For example, LLVM-GCC compiles to LLVM-assembly or LLVM-bytecode, which is then compiled to machine code. Almost all compilers have some sort of internal representation, LLVM-GCC use LLVM, and, IIRC, GCC uses something called GIMPLE.
If you are talking about debugging to see the assembly code, the easiest way is Debug->Windows->Disassembly (or Alt-8). This will let you step into a called function and stay in Disassembly.
Add -S
switch to your command line.
Edit: Do not forget that it will place the assembly to the files you specified under -o
switch.
How to restrict it to a specific function or a code block?
Put that function in a separate source file (and use a different command-line parameter for that one source file).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With