X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11llvm.git;a=blobdiff_plain;f=isAtomicCall.hpp;h=99e7532af64c49e670dc009512d2660beee4f02b;hp=419312cf6f380fb4a4dc5041426a0ada0ec6ff40;hb=c9efd55388808675480a2f3f476959dd7e5de4be;hpb=b8ee0fcbdf6e8d37dc8bf48da920241dd50fe503 diff --git a/isAtomicCall.hpp b/isAtomicCall.hpp index 419312c..99e7532 100644 --- a/isAtomicCall.hpp +++ b/isAtomicCall.hpp @@ -6,11 +6,17 @@ bool isAtomicCall(Instruction *I) { if ( auto *CI = dyn_cast(I) ) { Function *fun = CI->getCalledFunction(); + if (fun == NULL) + return false; + StringRef funName = fun->getName(); - if ( (CI->isTailCall() && funName.contains("atomic_")) || - funName.contains("atomic_compare_exchange_") ) { - printArgs(CI); + // todo: come up with better rules for function name checking + if ( funName.contains("atomic_") ) { + // printArgs(CI); + return true; + } else if (funName.contains("atomic") ) { + // errs() << "intercepted atomic calls: " << *I << "\n"; return true; } } @@ -26,7 +32,7 @@ void printArgs (CallInst *CI) User::op_iterator begin = CI->arg_begin(); User::op_iterator end = CI->arg_end(); - if (funName.find("atomic_") != -1) { + if ( funName.contains("atomic_") ) { std::vector parameters; for (User::op_iterator it = begin; it != end; ++it) {