From: weiyu Date: Wed, 24 Jul 2019 01:15:44 +0000 (-0700) Subject: instrument entries and exits of functions that contain volatile loads and stores X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=dbca9deee4a28c78ba855fddc3c0d1250e3475b2;p=c11llvm.git instrument entries and exits of functions that contain volatile loads and stores --- diff --git a/CDSPass.cpp b/CDSPass.cpp index 50aca18..6ec6dd2 100644 --- a/CDSPass.cpp +++ b/CDSPass.cpp @@ -327,6 +327,7 @@ bool CDSPass::runOnFunction(Function &F) { bool Res = false; bool HasAtomic = false; + bool HasVolatile = false; const DataLayout &DL = F.getParent()->getDataLayout(); // errs() << "--- " << F.getName() << "---\n"; @@ -341,9 +342,10 @@ bool CDSPass::runOnFunction(Function &F) { StoreInst *SI = dyn_cast(&I); bool isVolatile = ( LI ? LI->isVolatile() : SI->isVolatile() ); - if (isVolatile) + if (isVolatile) { VolatileLoadsAndStores.push_back(&I); - else + HasVolatile = true; + } else LocalLoadsAndStores.push_back(&I); } else if (isa(I) || isa(I)) { // not implemented yet @@ -366,7 +368,7 @@ bool CDSPass::runOnFunction(Function &F) { } // only instrument functions that contain atomics - if (Res && HasAtomic) { + if (Res && ( HasAtomic || HasVolatile) ) { IRBuilder<> IRB(F.getEntryBlock().getFirstNonPHI()); /* Unused for now Value *ReturnAddress = IRB.CreateCall(