r203838 - CodeGen: use symbolic enumerators for memory order
Tim Northover
tnorthover at apple.com
Thu Mar 13 12:25:53 PDT 2014
Author: tnorthover
Date: Thu Mar 13 14:25:52 2014
New Revision: 203838
URL: http://llvm.org/viewvc/llvm-project?rev=203838&view=rev
Log:
CodeGen: use symbolic enumerators for memory order
It makes the code clearer and less error-prone to use our (already
known) special values for the various memory order cases.
Modified:
cfe/trunk/lib/CodeGen/CGAtomic.cpp
Modified: cfe/trunk/lib/CodeGen/CGAtomic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGAtomic.cpp?rev=203838&r1=203837&r2=203838&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGAtomic.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGAtomic.cpp Thu Mar 13 14:25:52 2014
@@ -785,28 +785,33 @@ RValue CodeGenFunction::EmitAtomicExpr(A
EmitAtomicOp(*this, E, Dest, Ptr, Val1, Val2, OrderFail,
Size, Align, llvm::Acquire);
Builder.CreateBr(ContBB);
- SI->addCase(Builder.getInt32(1), AcquireBB);
- SI->addCase(Builder.getInt32(2), AcquireBB);
+ SI->addCase(Builder.getInt32(AtomicExpr::AO_ABI_memory_order_consume),
+ AcquireBB);
+ SI->addCase(Builder.getInt32(AtomicExpr::AO_ABI_memory_order_acquire),
+ AcquireBB);
}
if (!IsLoad) {
Builder.SetInsertPoint(ReleaseBB);
EmitAtomicOp(*this, E, Dest, Ptr, Val1, Val2, OrderFail,
Size, Align, llvm::Release);
Builder.CreateBr(ContBB);
- SI->addCase(Builder.getInt32(3), ReleaseBB);
+ SI->addCase(Builder.getInt32(AtomicExpr::AO_ABI_memory_order_release),
+ ReleaseBB);
}
if (!IsLoad && !IsStore) {
Builder.SetInsertPoint(AcqRelBB);
EmitAtomicOp(*this, E, Dest, Ptr, Val1, Val2, OrderFail,
Size, Align, llvm::AcquireRelease);
Builder.CreateBr(ContBB);
- SI->addCase(Builder.getInt32(4), AcqRelBB);
+ SI->addCase(Builder.getInt32(AtomicExpr::AO_ABI_memory_order_acq_rel),
+ AcqRelBB);
}
Builder.SetInsertPoint(SeqCstBB);
EmitAtomicOp(*this, E, Dest, Ptr, Val1, Val2, OrderFail,
Size, Align, llvm::SequentiallyConsistent);
Builder.CreateBr(ContBB);
- SI->addCase(Builder.getInt32(5), SeqCstBB);
+ SI->addCase(Builder.getInt32(AtomicExpr::AO_ABI_memory_order_seq_cst),
+ SeqCstBB);
// Cleanup and return
Builder.SetInsertPoint(ContBB);
More information about the cfe-commits
mailing list