mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Expose the fence instruction via the C API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195173 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3da011f561
commit
d54beffaa3
@ -2663,7 +2663,9 @@ LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef, LLVMValueRef Val,
|
||||
const char *Name);
|
||||
LLVMValueRef LLVMBuildPtrDiff(LLVMBuilderRef, LLVMValueRef LHS,
|
||||
LLVMValueRef RHS, const char *Name);
|
||||
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B,LLVMAtomicRMWBinOp op,
|
||||
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering ordering,
|
||||
LLVMBool singleThread, const char *Name);
|
||||
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op,
|
||||
LLVMValueRef PTR, LLVMValueRef Val,
|
||||
LLVMAtomicOrdering ordering,
|
||||
LLVMBool singleThread);
|
||||
|
@ -915,8 +915,9 @@ public:
|
||||
return SI;
|
||||
}
|
||||
FenceInst *CreateFence(AtomicOrdering Ordering,
|
||||
SynchronizationScope SynchScope = CrossThread) {
|
||||
return Insert(new FenceInst(Context, Ordering, SynchScope));
|
||||
SynchronizationScope SynchScope = CrossThread,
|
||||
const Twine &Name = "") {
|
||||
return Insert(new FenceInst(Context, Ordering, SynchScope), Name);
|
||||
}
|
||||
AtomicCmpXchgInst *CreateAtomicCmpXchg(Value *Ptr, Value *Cmp, Value *New,
|
||||
AtomicOrdering Ordering,
|
||||
|
@ -2219,6 +2219,29 @@ LLVMValueRef LLVMBuildStore(LLVMBuilderRef B, LLVMValueRef Val,
|
||||
return wrap(unwrap(B)->CreateStore(unwrap(Val), unwrap(PointerVal)));
|
||||
}
|
||||
|
||||
static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering) {
|
||||
switch (Ordering) {
|
||||
case LLVMAtomicOrderingNotAtomic: return NotAtomic;
|
||||
case LLVMAtomicOrderingUnordered: return Unordered;
|
||||
case LLVMAtomicOrderingMonotonic: return Monotonic;
|
||||
case LLVMAtomicOrderingAcquire: return Acquire;
|
||||
case LLVMAtomicOrderingRelease: return Release;
|
||||
case LLVMAtomicOrderingAcquireRelease: return AcquireRelease;
|
||||
case LLVMAtomicOrderingSequentiallyConsistent:
|
||||
return SequentiallyConsistent;
|
||||
}
|
||||
|
||||
llvm_unreachable("Invalid LLVMAtomicOrdering value!");
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering Ordering,
|
||||
LLVMBool isSingleThread, const char *Name) {
|
||||
return wrap(
|
||||
unwrap(B)->CreateFence(mapFromLLVMOrdering(Ordering),
|
||||
isSingleThread ? SingleThread : CrossThread,
|
||||
Name));
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMBuildGEP(LLVMBuilderRef B, LLVMValueRef Pointer,
|
||||
LLVMValueRef *Indices, unsigned NumIndices,
|
||||
const char *Name) {
|
||||
@ -2476,22 +2499,8 @@ LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B,LLVMAtomicRMWBinOp op,
|
||||
case LLVMAtomicRMWBinOpUMax: intop = AtomicRMWInst::UMax; break;
|
||||
case LLVMAtomicRMWBinOpUMin: intop = AtomicRMWInst::UMin; break;
|
||||
}
|
||||
AtomicOrdering intordering;
|
||||
switch (ordering) {
|
||||
case LLVMAtomicOrderingNotAtomic: intordering = NotAtomic; break;
|
||||
case LLVMAtomicOrderingUnordered: intordering = Unordered; break;
|
||||
case LLVMAtomicOrderingMonotonic: intordering = Monotonic; break;
|
||||
case LLVMAtomicOrderingAcquire: intordering = Acquire; break;
|
||||
case LLVMAtomicOrderingRelease: intordering = Release; break;
|
||||
case LLVMAtomicOrderingAcquireRelease:
|
||||
intordering = AcquireRelease;
|
||||
break;
|
||||
case LLVMAtomicOrderingSequentiallyConsistent:
|
||||
intordering = SequentiallyConsistent;
|
||||
break;
|
||||
}
|
||||
return wrap(unwrap(B)->CreateAtomicRMW(intop, unwrap(PTR), unwrap(Val),
|
||||
intordering, singleThread ? SingleThread : CrossThread));
|
||||
mapFromLLVMOrdering(ordering), singleThread ? SingleThread : CrossThread));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user