Add singlethreaded fence intrinsics.

These new intrinsics are comparable to `atomic_signal_fence` in C++,
ensuring the compiler will not reorder memory accesses across the
barrier, nor will it emit any machine instructions for it.

Closes #24118, implementing RFC 888.
This commit is contained in:
Peter Marheine 2015-02-14 23:48:10 -07:00
parent 0d8309ec0b
commit 998c10d6b6
7 changed files with 43 additions and 11 deletions

View file

@ -43,6 +43,7 @@ pub use self::RealPredicate::*;
pub use self::TypeKind::*;
pub use self::AtomicBinOp::*;
pub use self::AtomicOrdering::*;
pub use self::SynchronizationScope::*;
pub use self::FileType::*;
pub use self::MetadataType::*;
pub use self::AsmDialect::*;
@ -361,6 +362,13 @@ pub enum AtomicOrdering {
SequentiallyConsistent = 7
}
#[repr(C)]
#[derive(Copy, Clone)]
pub enum SynchronizationScope {
SingleThread = 0,
CrossThread = 1
}
// Consts for the LLVMCodeGenFileType type (in include/llvm/c/TargetMachine.h)
#[repr(C)]
#[derive(Copy, Clone)]
@ -1534,7 +1542,9 @@ extern {
SingleThreaded: Bool)
-> ValueRef;
pub fn LLVMBuildAtomicFence(B: BuilderRef, Order: AtomicOrdering);
pub fn LLVMBuildAtomicFence(B: BuilderRef,
Order: AtomicOrdering,
Scope: SynchronizationScope);
/* Selected entries from the downcasts. */