You should be able to do
-fno-schedule-insns and -fno-schedule-insns2
to turn the scheduler off. You can verify by doing
-Wreorder
This will tell you when something is reordered.
As a note, these optimizations above all are supposed to maintain program
integrity. Meaning they shouldn't change the output. Are you
experiencing this? If so, you may have found a GCC bug (I found one once
deep in the bowels of their scheduler a few years ago) and you should do
your civic duty and submit a bug report 8-).
HTH
-- Chris
On Wed, 5 Sep 2001, Foo Lim wrote:
> Hi all,
>
> Is there any way to tell the gcc compiler not to reorder/optimize certain
> parts of the code. My problem stems when I try to compile a C/C++ program
> with -O3 optimizations (which is required in this project). I have a
> macro that calls this multiple times:
>
> #define queue_store(address, value) \
> asm("list_0store $0, %0, %1" : : "r" (address), "r" (value) );
>
>
> An example usage of the above assembly macro would be:
>
> #define ExampleUse (t1, t2) \
> queue_store(addr, t1); \
> queue_store(addr, t2);
>
> (Actually, the macro that causes the most problems have 5 parameters.)
>
> The assembly for ExampleUse needs to be together. What the compiler likes
> to do is reorder the queue_stores into what it thinks is the best way to
> allocate registers and optimize the execution. Are there any directives I
> can set within ExampleUse() or anything I can do to prevent the
> reordering?
>
> Thanks In Advance!
> FL
>
> P.S. The above is MIPS assembly if that helps, and the list_0store is not
> a standard MIPS instruction.
>