add support for libcds atomic function calls
[c11llvm.git] / isAtomicCall.hpp
index 11e5e68b77ee25a02d8a84ac4e39f7280d220b2f..99e7532af64c49e670dc009512d2660beee4f02b 100644 (file)
@@ -6,12 +6,18 @@ bool isAtomicCall(Instruction *I)
 {
        if ( auto *CI = dyn_cast<CallInst>(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_") ) {
+               // 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;
                }
        }