diff options
author | Chris Lattner <sabre@nondot.org> | 2012-03-22 03:54:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2012-03-22 03:54:15 +0000 |
commit | eabe3ad57d824c2b07016352fd97ce85777b6f9d (patch) | |
tree | 4233cebe895fff93c3ee7b6d87d1eb4691ee95ce | |
parent | 1fe6bfca593404e261922990f230326934dda4d6 (diff) | |
download | external_llvm-eabe3ad57d824c2b07016352fd97ce85777b6f9d.zip external_llvm-eabe3ad57d824c2b07016352fd97ce85777b6f9d.tar.gz external_llvm-eabe3ad57d824c2b07016352fd97ce85777b6f9d.tar.bz2 |
add load/store volatility control to the C API, patch by Yiannis Tsiouris!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153238 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm-c/Core.h | 2 | ||||
-rw-r--r-- | lib/VMCore/Core.cpp | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index 52b8b1c..7774606 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -2398,6 +2398,8 @@ LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str, const char *Name); LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, const char *Name); +LLVMBool LLVMGetVolatile(LLVMValueRef MemoryAccessInst); +void LLVMSetVolatile(LLVMValueRef MemoryAccessInst, LLVMBool IsVolatile); /* Casts */ LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef, LLVMValueRef Val, diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp index e86d805..a9cca22 100644 --- a/lib/VMCore/Core.cpp +++ b/lib/VMCore/Core.cpp @@ -2066,6 +2066,20 @@ LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, return wrap(unwrap(B)->CreateGlobalStringPtr(Str, Name)); } +LLVMBool LLVMGetVolatile(LLVMValueRef MemAccessInst) { + Value *P = unwrap<Value>(MemAccessInst); + if (LoadInst *LI = dyn_cast<LoadInst>(P)) + return LI->isVolatile(); + return cast<StoreInst>(P)->isVolatile(); +} + +void LLVMSetVolatile(LLVMValueRef MemAccessInst, LLVMBool isVolatile) { + Value *P = unwrap<Value>(MemAccessInst); + if (LoadInst *LI = dyn_cast<LoadInst>(P)) + return LI->setVolatile(isVolatile); + return cast<StoreInst>(P)->setVolatile(isVolatile); +} + /*--.. Casts ...............................................................--*/ LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef B, LLVMValueRef Val, |