[ECOS] How can HAL_REORDER_BARRIER() prevent optimization? Thanks a lot

Qiang Huang jameshq@liverpool.ac.uk
Fri Oct 4 08:38:00 GMT 2002


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



More information about the Ecos-discuss mailing list