get rid of rustc_codegen_ssa::common::AtomicOrdering
This commit is contained in:
@@ -59,15 +59,6 @@ pub enum AtomicRmwBinOp {
|
||||
AtomicUMin,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum AtomicOrdering {
|
||||
Relaxed,
|
||||
Acquire,
|
||||
Release,
|
||||
AcquireRelease,
|
||||
SequentiallyConsistent,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum SynchronizationScope {
|
||||
SingleThread,
|
||||
|
||||
@@ -345,7 +345,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
// This requires that atomic intrinsics follow a specific naming pattern:
|
||||
// "atomic_<operation>[_<ordering>]"
|
||||
name if let Some(atomic) = name_str.strip_prefix("atomic_") => {
|
||||
use crate::common::AtomicOrdering::*;
|
||||
use rustc_middle::ty::AtomicOrdering::*;
|
||||
|
||||
use crate::common::{AtomicRmwBinOp, SynchronizationScope};
|
||||
|
||||
let invalid_monomorphization = |ty| {
|
||||
@@ -358,16 +359,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
|
||||
let parse_const_generic_ordering = |ord: ty::Value<'tcx>| {
|
||||
let discr = ord.valtree.unwrap_branch()[0].unwrap_leaf();
|
||||
let ord = discr.to_atomic_ordering();
|
||||
// We have to translate from the intrinsic ordering to the backend ordering.
|
||||
use rustc_middle::ty::AtomicOrdering;
|
||||
match ord {
|
||||
AtomicOrdering::Relaxed => Relaxed,
|
||||
AtomicOrdering::Release => Release,
|
||||
AtomicOrdering::Acquire => Acquire,
|
||||
AtomicOrdering::AcqRel => AcquireRelease,
|
||||
AtomicOrdering::SeqCst => SequentiallyConsistent,
|
||||
}
|
||||
discr.to_atomic_ordering()
|
||||
};
|
||||
|
||||
// Some intrinsics have the ordering already converted to a const generic parameter, we handle those first.
|
||||
@@ -403,8 +395,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
"relaxed" => Relaxed,
|
||||
"acquire" => Acquire,
|
||||
"release" => Release,
|
||||
"acqrel" => AcquireRelease,
|
||||
"seqcst" => SequentiallyConsistent,
|
||||
"acqrel" => AcqRel,
|
||||
"seqcst" => SeqCst,
|
||||
_ => bx.sess().dcx().emit_fatal(errors::UnknownAtomicOrdering),
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::ops::Deref;
|
||||
use rustc_abi::{Align, Scalar, Size, WrappingRange};
|
||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
|
||||
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{Instance, Ty};
|
||||
use rustc_middle::ty::{AtomicOrdering, Instance, Ty};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::Span;
|
||||
use rustc_target::callconv::FnAbi;
|
||||
@@ -19,9 +19,7 @@ use super::misc::MiscCodegenMethods;
|
||||
use super::type_::{ArgAbiBuilderMethods, BaseTypeCodegenMethods, LayoutTypeCodegenMethods};
|
||||
use super::{CodegenMethods, StaticBuilderMethods};
|
||||
use crate::MemFlags;
|
||||
use crate::common::{
|
||||
AtomicOrdering, AtomicRmwBinOp, IntPredicate, RealPredicate, SynchronizationScope, TypeKind,
|
||||
};
|
||||
use crate::common::{AtomicRmwBinOp, IntPredicate, RealPredicate, SynchronizationScope, TypeKind};
|
||||
use crate::mir::operand::{OperandRef, OperandValue};
|
||||
use crate::mir::place::{PlaceRef, PlaceValue};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user