[LangRef] asm clobber constrains: '~memory' allows reads and synchronization (#150191)

I was not sure what the best way is for talking about "synchronization effects".
This commit is contained in:
Ralf Jung
2026-04-29 23:16:32 +02:00
committed by GitHub
parent 9f720984f0
commit a26d9c6037

View File

@@ -5760,10 +5760,13 @@ Clobber constraints
A clobber constraint is indicated by a "``~``" prefix. A clobber does not
consume an input operand, nor generate an output. Clobbers cannot use any of the
general constraint code letters -- they may use only explicit register
constraints, e.g., "``~{eax}``". The one exception is that a clobber string of
"``~{memory}``" indicates that the assembly writes to arbitrary undeclared
memory locations -- not only the memory pointed to by a declared indirect
output.
constraints, e.g., "``~{eax}``".
The one exception is that a clobber string of "``~{memory}``" indicates that the
assembly reads and writes to arbitrary undeclared memory locations -- not only
the memory pointed to by a declared indirect output. Furthermore, the assembly
may also cause synchronization with other threads, such as via release/acquire
fences and atomic memory accesses.
Note that clobbering named registers that are also present in output
constraints is not legal.