This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
How can HAL_REORDER_BARRIER() prevent optimization? Thanks a lot
- From: "Qiang Huang" <jameshq at liverpool dot ac dot uk>
- To: "Ecos-Discuss" <ecos-discuss at sources dot redhat dot com>
- Date: Fri, 4 Oct 2002 16:37:52 +0100
- Subject: [ECOS] How can HAL_REORDER_BARRIER() prevent optimization? Thanks a lot
As defined as:
#define HAL_REORDER_BARRIER() asm volatile ( "" : : : "memory" )
If as:
HAL_REORDER_BARRIER( );
do_something_fun( );
HAL_REORDER_BARRIER( );
Will do_something_fun( ) be protected(not being optimized(eg. delete, move
etc.)) while it is surrounded by two HAL_REORDER_BARRIER( )s?
How does this work?
compared to an example from the GNUPro document. "GNUPro Compiler Tool P179"
as:
asm volatile ( "movc3 %0, %1, %2"
: /* no outputs */
: "g" (from), "g" (to), "g" (count)
: "r0", "r1", "r2", "r3", "r4", "r5" );
what is meaning of "memory" in the HAL_REORDER_BARRIER macro??
Thanks a lot.
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss