Volatile Memory Locations

Typically memory mapped devices use a volatile declaration modifier to prevent the compiler from optimizing out loads and stores. The current implementation of the optimizer uses read-modify-write instructions where possible instead of a load, operation, store instruction sequence. If this creates a problem for a particular device, you need to turn off the peephole optimizer for routines accessing it.

Listing: Turning off the peephole optimizer

#pragma peephole off

void foo (void)f 

{...}

#pragma peephole reset