So I know that *_volatile
functions are not allowed to assume that a value in memory does not change between reads/writes. But sometimes there may be multiple memory-mapped registers that are connected, and the order that they are written to matters. Is the compiler allowed to re-order volatile reads/writes to different addresses? Can this be stopped with compiler_fence
or fence
in std::sync::atomic
?
In the armcc code there is instruction synchronization barrier, data synchronization barrier, and data memory barrier. What are the differences between these, and how do they correspond with what is available in std
?