Tuesday, 8 September 2009

Handy hints for debugging optimised assembly, number 2431

If you're trying to see what effect your optimisations have on assembly code, a useful hint is often to put volatile assembler labels at strategic points in your code.
asm volatile ("foo1:");
in GNU C/C++ source will turn into something like:
# 667 "src/iatools.cpp" 1
# 0 "" 2
in the assembler. This may have some slightly adverse effects on the optimiser (though not too many - labels have no side-effects), but it means you can bracket loops you're trying to optimise quite successfully without having to read the runes to work out which bits of assembler correspond to which bits of C.

No comments:

Post a Comment