rustc_codegen_ssa: derive copy and clone for various enums
This commit is contained in:
parent
f4c92cc4d1
commit
ef83e689a8
@ -61,23 +61,6 @@ enum ExtremumOperation {
|
||||
Min,
|
||||
}
|
||||
|
||||
trait EnumClone {
|
||||
fn clone(&self) -> Self;
|
||||
}
|
||||
|
||||
impl EnumClone for AtomicOrdering {
|
||||
fn clone(&self) -> Self {
|
||||
match *self {
|
||||
AtomicOrdering::Unordered => AtomicOrdering::Unordered,
|
||||
AtomicOrdering::Relaxed => AtomicOrdering::Relaxed,
|
||||
AtomicOrdering::Acquire => AtomicOrdering::Acquire,
|
||||
AtomicOrdering::Release => AtomicOrdering::Release,
|
||||
AtomicOrdering::AcquireRelease => AtomicOrdering::AcquireRelease,
|
||||
AtomicOrdering::SequentiallyConsistent => AtomicOrdering::SequentiallyConsistent,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Builder<'a: 'gcc, 'gcc, 'tcx> {
|
||||
pub cx: &'a CodegenCx<'gcc, 'tcx>,
|
||||
pub block: Block<'gcc>,
|
||||
@ -102,9 +85,9 @@ fn atomic_extremum(&mut self, operation: ExtremumOperation, dst: RValue<'gcc>, s
|
||||
match order {
|
||||
// TODO(antoyo): does this make sense?
|
||||
AtomicOrdering::AcquireRelease | AtomicOrdering::Release => AtomicOrdering::Acquire,
|
||||
_ => order.clone(),
|
||||
_ => order,
|
||||
};
|
||||
let previous_value = self.atomic_load(dst.get_type(), dst, load_ordering.clone(), Size::from_bytes(size));
|
||||
let previous_value = self.atomic_load(dst.get_type(), dst, load_ordering, Size::from_bytes(size));
|
||||
let previous_var = func.new_local(None, previous_value.get_type(), "previous_value");
|
||||
let return_value = func.new_local(None, previous_value.get_type(), "return_value");
|
||||
self.llbb().add_assignment(None, previous_var, previous_value);
|
||||
|
@ -11,6 +11,7 @@
|
||||
use crate::base;
|
||||
use crate::traits::*;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum IntPredicate {
|
||||
IntEQ,
|
||||
IntNE,
|
||||
@ -24,6 +25,7 @@ pub enum IntPredicate {
|
||||
IntSLE,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum RealPredicate {
|
||||
RealPredicateFalse,
|
||||
RealOEQ,
|
||||
@ -43,6 +45,7 @@ pub enum RealPredicate {
|
||||
RealPredicateTrue,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum AtomicRmwBinOp {
|
||||
AtomicXchg,
|
||||
AtomicAdd,
|
||||
@ -57,6 +60,7 @@ pub enum AtomicRmwBinOp {
|
||||
AtomicUMin,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum AtomicOrdering {
|
||||
Unordered,
|
||||
Relaxed,
|
||||
@ -66,6 +70,7 @@ pub enum AtomicOrdering {
|
||||
SequentiallyConsistent,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum SynchronizationScope {
|
||||
SingleThread,
|
||||
CrossThread,
|
||||
|
Loading…
Reference in New Issue
Block a user