Specifically, clarify the following:
- Volatile load and store may access addresses that are not memory (MMIO registers, etc.).
- Volatile load and store do not modify unrelated memory.
- Volatile load and store do not trap.
Prompted by recent discussion of volatile on llvmdev. I think this is enough to resolve all the issues brought up in that discussion, at least from the perspective of LangRef.
Currently, there's sort of a split in the LLVM source code about whether volatile operations are allowed to trap; this resolves that dispute in favor of not allowing them to trap. (This is the opposite of the position I originally took, but thinking about it a bit more it makes sense for the uses we expect.)
Hal brought up the possibility on llvmdev that certain APIs like isSafeToLoadUnconditionally and FindAvailablePtrLoadStore might assume that volatile operations do in fact point to memory; I think we should just treat that as a bug, though.
Sorry for missing the initial discussion. This disallows using mmap to map the same physical memory into two different virtual addresses in the same process. In C++ volatile loads and stores exist to denote "external modifications", where "external" is w.r.t. the abstract machine. It seems like a misstep to say that "A volatile operation may not modify any other memory accessible by the module being compiled."