bjorn3
June 14, 2020, 1:07pm
2
Instead of having to explicitly use volatile
, volatile
is the default and you have to opt-out if you want using pure
. This is done to prevent forgetting to use volatile
when you need to.
- Feature Name: `asm`
- Start Date: (fill me in with today's date, YYYY-MM-DD)
- RFC PR: [rust-lang/rfcs#0000](https://github.com/rust-lang/rfcs/pull/0000)
- Rust Issue: [rust-lang/rust#0000](https://github.com/rust-lang/rust/issues/0000)
# Summary
[summary]: #summary
This RFC specifies a new syntax for inline assembly which is suitable for eventual stabilization.
The initial implementation of this feature will focus on the ARM, x86 and RISC-V architectures. Support for more architectures will be added based on user demand.
The transition from the existing `asm!` macro is described in RFC [2843][rfc-llvm-asm]. The existing `asm!` macro will be renamed to `llvm_asm!` to provide an easy way to maintain backwards-compatibility with existing code using inline asm. However `llvm_asm!` is not intended to ever be stabilized.
[rfc-llvm-asm]: https://github.com/rust-lang/rfcs/pull/2843
# Motivation
[motivation]: #motivation
In systems programming some tasks require dropping down to the assembly level. The primary reasons are for performance, precise timing, and low level hardware access. Using inline assembly for this is sometimes convenient, and sometimes necessary to avoid function call overhead.
This file has been truncated. show original
https://github.com/rust-lang/rust/pull/69171/files#diff-6e23b9d7fff06f32f7b69cd2e63b0826R265
let volatile = !options.contains(InlineAsmOptions::PURE);
3 Likes