Skip to content

Commit e722fc7

Browse files
committed
[Volatile] Rename UnsafeVolatilePointer to VolatileMappedRegister, use 'unsafe' name in initializer
1 parent 81f8b2a commit e722fc7

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

stdlib/public/Volatile/Volatile.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ import Swift
2323
/// or reordered with other volatile operations by the compiler. They may be
2424
/// reordered with non-volatile operations. For details, see
2525
/// <https://llvm.org/docs/LangRef.html#volatile-memory-accesses>.
26-
public struct UnsafeVolatilePointer<Pointee> {
26+
public struct VolatileMappedRegister<Pointee> {
2727
public var _rawPointer: Builtin.RawPointer
28-
public init(bitPattern: UInt) {
29-
_rawPointer = UnsafeRawPointer(bitPattern: bitPattern)!._rawValue
28+
public init(unsafeBitPattern: UInt) {
29+
_rawPointer = UnsafeRawPointer(bitPattern: unsafeBitPattern)!._rawValue
3030
}
3131
}
3232

33-
extension UnsafeVolatilePointer where Pointee == UInt8 {
33+
extension VolatileMappedRegister where Pointee == UInt8 {
3434
/// Perform an 8-bit volatile load operation from the target pointer.
3535
///
3636
/// Do not use for inter-thread synchronization.
@@ -48,7 +48,7 @@ extension UnsafeVolatilePointer where Pointee == UInt8 {
4848
}
4949
}
5050

51-
extension UnsafeVolatilePointer where Pointee == UInt16 {
51+
extension VolatileMappedRegister where Pointee == UInt16 {
5252
/// Perform a 16-bit volatile load operation from the target pointer.
5353
///
5454
/// Do not use for inter-thread synchronization.
@@ -66,7 +66,7 @@ extension UnsafeVolatilePointer where Pointee == UInt16 {
6666
}
6767
}
6868

69-
extension UnsafeVolatilePointer where Pointee == UInt32 {
69+
extension VolatileMappedRegister where Pointee == UInt32 {
7070
/// Perform a 32-bit volatile load operation from the target pointer.
7171
///
7272
/// Do not use for inter-thread synchronization.
@@ -84,7 +84,7 @@ extension UnsafeVolatilePointer where Pointee == UInt32 {
8484
}
8585
}
8686

87-
extension UnsafeVolatilePointer where Pointee == UInt64 {
87+
extension VolatileMappedRegister where Pointee == UInt64 {
8888
/// Perform a 64-bit volatile load operation from the target pointer.
8989
///
9090
/// Do not use for inter-thread synchronization.

test/Volatile/volatile-ir.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import _Volatile
77

88
public func test_uint8() -> UInt8 {
9-
let p = UnsafeVolatilePointer<UInt8>(bitPattern: 0xf000baaa)
9+
let p = VolatileMappedRegister<UInt8>(bitPattern: 0xf000baaa)
1010
p.store(42)
1111
return p.load()
1212
}
@@ -18,7 +18,7 @@ public func test_uint8() -> UInt8 {
1818
// CHECK: }
1919

2020
public func test_uint16() -> UInt16 {
21-
let p = UnsafeVolatilePointer<UInt16>(bitPattern: 0xf000baaa)
21+
let p = VolatileMappedRegister<UInt16>(bitPattern: 0xf000baaa)
2222
p.store(42)
2323
return p.load()
2424
}
@@ -30,7 +30,7 @@ public func test_uint16() -> UInt16 {
3030
// CHECK: }
3131

3232
public func test_uint32() -> UInt32 {
33-
let p = UnsafeVolatilePointer<UInt32>(bitPattern: 0xf000baaa)
33+
let p = VolatileMappedRegister<UInt32>(bitPattern: 0xf000baaa)
3434
p.store(42)
3535
return p.load()
3636
}
@@ -42,7 +42,7 @@ public func test_uint32() -> UInt32 {
4242
// CHECK: }
4343

4444
public func test_uint64() -> UInt64 {
45-
let p = UnsafeVolatilePointer<UInt64>(bitPattern: 0xf000baaa)
45+
let p = VolatileMappedRegister<UInt64>(bitPattern: 0xf000baaa)
4646
p.store(42)
4747
return p.load()
4848
}

test/Volatile/volatile-repeat-loads.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import _Volatile
77

88
public func test_volatilepointer() -> UInt8 {
9-
let p = UnsafeVolatilePointer<UInt8>(bitPattern: 0xf000baaa)
9+
let p = VolatileMappedRegister<UInt8>(bitPattern: 0xf000baaa)
1010
p.store(42)
1111
let a = p.load()
1212
let b = p.load()

0 commit comments

Comments
 (0)