diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2014-04-22 19:51:14 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2014-04-22 20:15:55 -0400 |
| commit | b2724727d52904e104ccb3ce14d9dc60ffee1dec (patch) | |
| tree | da6ba9ff9646032e01c48494b971b640bf2e16b9 /src/libstd | |
| parent | 09bfb92fdc3ccff42dfcf91b0af368f88dc3e446 (diff) | |
| download | rust-b2724727d52904e104ccb3ce14d9dc60ffee1dec.tar.gz rust-b2724727d52904e104ccb3ce14d9dc60ffee1dec.zip | |
add volatile copy/copy_nonoverlapping/set
This exposes volatile versions of the memset/memmove/memcpy intrinsics. The volatile parameter must be constant, so this can't simply be a parameter to our intrinsics.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/intrinsics.rs | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/libstd/intrinsics.rs b/src/libstd/intrinsics.rs index 7f02ab28342..1b419e59a70 100644 --- a/src/libstd/intrinsics.rs +++ b/src/libstd/intrinsics.rs @@ -261,10 +261,6 @@ extern "rust-intrinsic" { /// Execute a breakpoint trap, for inspection by a debugger. pub fn breakpoint(); - pub fn volatile_load<T>(src: *T) -> T; - pub fn volatile_store<T>(dst: *mut T, val: T); - - /// The size of a type in bytes. /// /// This is the exact number of bytes in memory taken up by a @@ -338,6 +334,33 @@ extern "rust-intrinsic" { /// `min_align_of::<T>()` pub fn set_memory<T>(dst: *mut T, val: u8, count: uint); + /// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with + /// a size of `count` * `size_of::<T>()` and an alignment of + /// `min_align_of::<T>()` + /// + /// The volatile parameter parameter is set to `true`, so it will not be optimized out. + #[cfg(not(stage0))] + pub fn volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *T, count: uint); + /// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with + /// a size of `count` * `size_of::<T>()` and an alignment of + /// `min_align_of::<T>()` + /// + /// The volatile parameter parameter is set to `true`, so it will not be optimized out. + #[cfg(not(stage0))] + pub fn volatile_copy_memory<T>(dst: *mut T, src: *T, count: uint); + /// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a + /// size of `count` * `size_of::<T>()` and an alignment of + /// `min_align_of::<T>()`. + /// + /// The volatile parameter parameter is set to `true`, so it will not be optimized out. + #[cfg(not(stage0))] + pub fn volatile_set_memory<T>(dst: *mut T, val: u8, count: uint); + + /// Perform a volatile load from the `src` pointer. + pub fn volatile_load<T>(src: *T) -> T; + /// Perform a volatile store to the `dst` pointer. + pub fn volatile_store<T>(dst: *mut T, val: T); + pub fn sqrtf32(x: f32) -> f32; pub fn sqrtf64(x: f64) -> f64; |
