as far as i know, a c++ compiler inputs c++ code, optimizes, converts it to assembly code, optimizes again, and then assembles into opcodes.
how does optimization work? here's some code:
in assembly it's probably something close to:Code:a = b; c = b; b = a; //swaps b and c b = b + 1;
does the optimizer just search for pre-defined patterns of logic? does it search for any kind of redundancy? how effective are the optimizations?Code:xchg ebx, ecx; inc ebx;