Skip to content

Commit

Permalink
Merge pull request #1442 from RalfJung/asm-terminate
Browse files Browse the repository at this point in the history
pure asm blocks must terminate
  • Loading branch information
ehuss authored Jan 27, 2024
2 parents d4eac74 + 8eda943 commit e848fbc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/inline-assembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e848fbc

Please sign in to comment.