Merge pull request #1442 from RalfJung/asm-terminate

pure asm blocks must terminate
This commit is contained in:
Eric Huss 2024-01-27 17:03:30 +00:00 committed by GitHub
commit e848fbcdfe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -412,7 +412,7 @@ The list of clobbered registers for each ABI is updated in rustc as architecture
Flags are used to further influence the behavior of the inline assembly block.
Currently the following options are defined:
- `pure`: The `asm!` block has no side effects, and its outputs depend only on its direct inputs (i.e. the values themselves, not what they point to) or values read from memory (unless the `nomem` options is also set).
- `pure`: The `asm!` block has no side effects, must eventually return, and its outputs depend only on its direct inputs (i.e. the values themselves, not what they point to) or values read from memory (unless the `nomem` options is also set).
This allows the compiler to execute the `asm!` block fewer times than specified in the program (e.g. by hoisting it out of a loop) or even eliminate it entirely if the outputs are not used.
The `pure` option must be combined with either the `nomem` or `readonly` options, otherwise a compile-time error is emitted.
- `nomem`: The `asm!` blocks does not read or write to any memory.