Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Unified Diff: lib/Analysis/NaCl/PNaClABIVerifyModule.cpp

Issue 17777004: Concurrency support for PNaCl ABI (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Clean up suggested by mseaborn. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/Analysis/NaCl/PNaClABIVerifyModule.cpp
diff --git a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp
index 8bf0848fd713df46478adf6a54569496e7a70dea..697d453b5382e078f29501b590bb449fceed8aea 100644
--- a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp
+++ b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp
@@ -13,14 +13,17 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Pass.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/NaCl.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
+#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Module.h"
+#include "llvm/IR/NaClIntrinsics.h"
+#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
@@ -67,6 +70,8 @@ class PNaClABIVerifyModule : public ModulePass {
virtual void print(raw_ostream &O, const Module *M) const;
private:
void checkGlobalValueCommon(const GlobalValue *GV);
+ bool isWhitelistedIntrinsic(const NaCl::AtomicIntrinsics *AI,
+ const Function *F, Intrinsic::ID ID);
bool isWhitelistedMetadata(const NamedMDNode *MD);
/// Returns whether \p GV is an allowed external symbol in stable bitcode.
@@ -173,6 +178,7 @@ void PNaClABIVerifyModule::checkGlobalValueCommon(const GlobalValue *GV) {
AllowedIntrinsics::AllowedIntrinsics(LLVMContext *Context) : Context(Context) {
Type *I8Ptr = Type::getInt8PtrTy(*Context);
+ Type *I8 = Type::getInt8Ty(*Context);
Type *I16 = Type::getInt16Ty(*Context);
Type *I32 = Type::getInt32Ty(*Context);
Type *I64 = Type::getInt64Ty(*Context);
@@ -197,6 +203,16 @@ AllowedIntrinsics::AllowedIntrinsics(LLVMContext *Context) : Context(Context) {
addIntrinsic(Intrinsic::nacl_longjmp);
addIntrinsic(Intrinsic::nacl_setjmp);
+ Type *AtomicTypes[] = { I8, I16, I32, I64 };
+ for (Type **T = &AtomicTypes[0], **E = T + array_lengthof(AtomicTypes);
eliben 2013/07/03 16:06:05 The double-pointer is an overkill here. Can't you
JF 2013/07/03 20:58:35 Done.
+ T != E; ++T) {
+ addIntrinsic(Intrinsic::nacl_atomic_load, *T);
+ addIntrinsic(Intrinsic::nacl_atomic_store, *T);
+ addIntrinsic(Intrinsic::nacl_atomic_rmw, *T);
+ addIntrinsic(Intrinsic::nacl_atomic_cmpxchg, *T);
+ }
+ addIntrinsic(Intrinsic::nacl_atomic_fence);
+
// Stack save and restore are used to support C99 VLAs.
addIntrinsic(Intrinsic::stacksave);
addIntrinsic(Intrinsic::stackrestore);
@@ -215,7 +231,7 @@ AllowedIntrinsics::AllowedIntrinsics(LLVMContext *Context) : Context(Context) {
bool AllowedIntrinsics::isAllowed(const Function *Func) {
// Keep 3 categories of intrinsics for now.
// (1) Allowed always, provided the exact name and type match.
- // (2) Never allowed
+ // (2) Never allowed.
// (3) "Dev" intrinsics, which may or may not be allowed.
// "Dev" intrinsics are controlled by the PNaClABIAllowDevIntrinsics flag.
// Please keep these sorted or grouped in a sensible way, within

Powered by Google App Engine
This is Rietveld 408576698