|
Boost : |
From: Peter Bindels (dascandy_at_[hidden])
Date: 2006-11-14 07:58:23
On 14/11/06, Giovanni Piero Deretta <gpderetta_at_[hidden]> wrote:
> While it is likely that most compilers will do whole program
> optimizations in the future and be able to reorder across compilation
> units, I think that it is extremely unlikely that compilers will ever
> reorder instructions in pure assembly modules. First of all because to
> do whole program optimization they need special data produced during
> compilation (that assembler modules lack), and also because they would
> render assembler programming useless. IMHO of course.
If you properly wrap the assembly code in asm volatile segments the
compiler should not touch them for anything. If you do not, it could
change it for anything. The linker can change around anything it
wants, in theory, and that's the one performing the whole-program
optimizations. If they move stuff around it could get duplicated, but
there should be an option telling the linker not to try that (possibly
with regard to a specific function), so that current practices
(specifically those relating to atomicity and protected instructions)
aren't made useless. I'm not sure whether you can specify that in the
code, although I expect some construction will be created to allow
that specifically for supporting header-based libraries.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk