This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]