2005-10-26, Jatin Bhateja <jatin.bhateja@amdocs.comwrote:
Now after the assembler converts it into objcode than can it be
determined at that time to which level that code is optimized
Though according to me it's not possible but I need your suggestions
on that.
[I would think that for a particular compiler and target system, you could
find patterns generated by each opt level, but in general it seems like a
hopeless waste of time. -John]
If the binary mustn't be extremely tight, simply add the compiler
options used as a string in the binary.
If not, as John says, you can implement heuristics, but these are horribly
compiler, level, target and (even minor!) version dependant
Moreover, with compilers like gcc, the levels are only global, and more
finegrained control over optimization (on a per specific optimization basis)
is usually possible.