projects
/
c11llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
106fed0
)
instrument entries and exits of functions that contain volatile loads and stores
author
weiyu
<weiyuluo1232@gmail.com>
Wed, 24 Jul 2019 01:15:44 +0000
(18:15 -0700)
committer
weiyu
<weiyuluo1232@gmail.com>
Wed, 24 Jul 2019 01:15:44 +0000
(18:15 -0700)
CDSPass.cpp
patch
|
blob
|
history
diff --git
a/CDSPass.cpp
b/CDSPass.cpp
index 50aca18a5114b23a81b934e3cbe9e18c3bab03f1..6ec6dd2aac73a40aa28ec491a6a06004dfc112a3 100644
(file)
--- a/
CDSPass.cpp
+++ b/
CDSPass.cpp
@@
-327,6
+327,7
@@
bool CDSPass::runOnFunction(Function &F) {
bool Res = false;
bool HasAtomic = false;
bool Res = false;
bool HasAtomic = false;
+ bool HasVolatile = false;
const DataLayout &DL = F.getParent()->getDataLayout();
// errs() << "--- " << F.getName() << "---\n";
const DataLayout &DL = F.getParent()->getDataLayout();
// errs() << "--- " << F.getName() << "---\n";
@@
-341,9
+342,10
@@
bool CDSPass::runOnFunction(Function &F) {
StoreInst *SI = dyn_cast<StoreInst>(&I);
bool isVolatile = ( LI ? LI->isVolatile() : SI->isVolatile() );
StoreInst *SI = dyn_cast<StoreInst>(&I);
bool isVolatile = ( LI ? LI->isVolatile() : SI->isVolatile() );
- if (isVolatile)
+ if (isVolatile)
{
VolatileLoadsAndStores.push_back(&I);
VolatileLoadsAndStores.push_back(&I);
- else
+ HasVolatile = true;
+ } else
LocalLoadsAndStores.push_back(&I);
} else if (isa<CallInst>(I) || isa<InvokeInst>(I)) {
// not implemented yet
LocalLoadsAndStores.push_back(&I);
} else if (isa<CallInst>(I) || isa<InvokeInst>(I)) {
// not implemented yet
@@
-366,7
+368,7
@@
bool CDSPass::runOnFunction(Function &F) {
}
// only instrument functions that contain atomics
}
// 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(
IRBuilder<> IRB(F.getEntryBlock().getFirstNonPHI());
/* Unused for now
Value *ReturnAddress = IRB.CreateCall(