Skip to content

Commit f4c92cc

Browse files
committed
rustc_codegen_ssa: cleanup AtomicOrdering
* Remove unused `NotAtomic` ordering. * Rename `Monotonic` to `Relaxed` - a Rust specific name.
1 parent fa70b89 commit f4c92cc

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

compiler/rustc_codegen_gcc/src/builder.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@ trait EnumClone {
6868
impl EnumClone for AtomicOrdering {
6969
fn clone(&self) -> Self {
7070
match *self {
71-
AtomicOrdering::NotAtomic => AtomicOrdering::NotAtomic,
7271
AtomicOrdering::Unordered => AtomicOrdering::Unordered,
73-
AtomicOrdering::Monotonic => AtomicOrdering::Monotonic,
72+
AtomicOrdering::Relaxed => AtomicOrdering::Relaxed,
7473
AtomicOrdering::Acquire => AtomicOrdering::Acquire,
7574
AtomicOrdering::Release => AtomicOrdering::Release,
7675
AtomicOrdering::AcquireRelease => AtomicOrdering::AcquireRelease,
@@ -1384,9 +1383,8 @@ impl ToGccOrdering for AtomicOrdering {
13841383

13851384
let ordering =
13861385
match self {
1387-
AtomicOrdering::NotAtomic => __ATOMIC_RELAXED, // TODO(antoyo): check if that's the same.
13881386
AtomicOrdering::Unordered => __ATOMIC_RELAXED,
1389-
AtomicOrdering::Monotonic => __ATOMIC_RELAXED, // TODO(antoyo): check if that's the same.
1387+
AtomicOrdering::Relaxed => __ATOMIC_RELAXED, // TODO(antoyo): check if that's the same.
13901388
AtomicOrdering::Acquire => __ATOMIC_ACQUIRE,
13911389
AtomicOrdering::Release => __ATOMIC_RELEASE,
13921390
AtomicOrdering::AcquireRelease => __ATOMIC_ACQ_REL,

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,8 @@ pub enum AtomicOrdering {
381381
impl AtomicOrdering {
382382
pub fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self {
383383
match ao {
384-
rustc_codegen_ssa::common::AtomicOrdering::NotAtomic => AtomicOrdering::NotAtomic,
385384
rustc_codegen_ssa::common::AtomicOrdering::Unordered => AtomicOrdering::Unordered,
386-
rustc_codegen_ssa::common::AtomicOrdering::Monotonic => AtomicOrdering::Monotonic,
385+
rustc_codegen_ssa::common::AtomicOrdering::Relaxed => AtomicOrdering::Monotonic,
387386
rustc_codegen_ssa::common::AtomicOrdering::Acquire => AtomicOrdering::Acquire,
388387
rustc_codegen_ssa::common::AtomicOrdering::Release => AtomicOrdering::Release,
389388
rustc_codegen_ssa::common::AtomicOrdering::AcquireRelease => {

compiler/rustc_codegen_ssa/src/common.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ pub enum AtomicRmwBinOp {
5858
}
5959

6060
pub enum AtomicOrdering {
61-
NotAtomic,
6261
Unordered,
63-
Monotonic,
64-
// Consume, // Not specified yet.
62+
Relaxed,
6563
Acquire,
6664
Release,
6765
AcquireRelease,

compiler/rustc_codegen_ssa/src/mir/intrinsic.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -388,17 +388,17 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
388388
2 => (SequentiallyConsistent, SequentiallyConsistent),
389389
3 => match split[2] {
390390
"unordered" => (Unordered, Unordered),
391-
"relaxed" => (Monotonic, Monotonic),
391+
"relaxed" => (Relaxed, Relaxed),
392392
"acq" => (Acquire, Acquire),
393-
"rel" => (Release, Monotonic),
393+
"rel" => (Release, Relaxed),
394394
"acqrel" => (AcquireRelease, Acquire),
395-
"failrelaxed" if is_cxchg => (SequentiallyConsistent, Monotonic),
395+
"failrelaxed" if is_cxchg => (SequentiallyConsistent, Relaxed),
396396
"failacq" if is_cxchg => (SequentiallyConsistent, Acquire),
397397
_ => bx.sess().fatal("unknown ordering in atomic intrinsic"),
398398
},
399399
4 => match (split[2], split[3]) {
400-
("acq", "failrelaxed") if is_cxchg => (Acquire, Monotonic),
401-
("acqrel", "failrelaxed") if is_cxchg => (AcquireRelease, Monotonic),
400+
("acq", "failrelaxed") if is_cxchg => (Acquire, Relaxed),
401+
("acqrel", "failrelaxed") if is_cxchg => (AcquireRelease, Relaxed),
402402
_ => bx.sess().fatal("unknown ordering in atomic intrinsic"),
403403
},
404404
_ => bx.sess().fatal("Atomic intrinsic not in correct format"),

0 commit comments

Comments
 (0)