mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-20 10:24:12 +00:00
[tsan] add 3 internal flags for fine-grain control of what is instrumented and what is not.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165204 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -47,6 +47,15 @@ using namespace llvm;
|
|||||||
|
|
||||||
static cl::opt<std::string> ClBlackListFile("tsan-blacklist",
|
static cl::opt<std::string> ClBlackListFile("tsan-blacklist",
|
||||||
cl::desc("Blacklist file"), cl::Hidden);
|
cl::desc("Blacklist file"), cl::Hidden);
|
||||||
|
static cl::opt<bool> ClInstrumentMemoryAccesses(
|
||||||
|
"tsan-instrument-memory-accesses", cl::init(true),
|
||||||
|
cl::desc("Instrument memory accesses"), cl::Hidden);
|
||||||
|
static cl::opt<bool> ClInstrumentFuncEntryExit(
|
||||||
|
"tsan-instrument-func-entry-exit", cl::init(true),
|
||||||
|
cl::desc("Instrument function entry and exit"), cl::Hidden);
|
||||||
|
static cl::opt<bool> ClInstrumentAtomics(
|
||||||
|
"tsan-instrument-atomics", cl::init(true),
|
||||||
|
cl::desc("Instrument atomics"), cl::Hidden);
|
||||||
|
|
||||||
STATISTIC(NumInstrumentedReads, "Number of instrumented reads");
|
STATISTIC(NumInstrumentedReads, "Number of instrumented reads");
|
||||||
STATISTIC(NumInstrumentedWrites, "Number of instrumented writes");
|
STATISTIC(NumInstrumentedWrites, "Number of instrumented writes");
|
||||||
@ -284,17 +293,19 @@ bool ThreadSanitizer::runOnFunction(Function &F) {
|
|||||||
// (e.g. variables that do not escape, etc).
|
// (e.g. variables that do not escape, etc).
|
||||||
|
|
||||||
// Instrument memory accesses.
|
// Instrument memory accesses.
|
||||||
for (size_t i = 0, n = AllLoadsAndStores.size(); i < n; ++i) {
|
if (ClInstrumentMemoryAccesses)
|
||||||
Res |= instrumentLoadOrStore(AllLoadsAndStores[i]);
|
for (size_t i = 0, n = AllLoadsAndStores.size(); i < n; ++i) {
|
||||||
}
|
Res |= instrumentLoadOrStore(AllLoadsAndStores[i]);
|
||||||
|
}
|
||||||
|
|
||||||
// Instrument atomic memory accesses.
|
// Instrument atomic memory accesses.
|
||||||
for (size_t i = 0, n = AtomicAccesses.size(); i < n; ++i) {
|
if (ClInstrumentAtomics)
|
||||||
Res |= instrumentAtomic(AtomicAccesses[i]);
|
for (size_t i = 0, n = AtomicAccesses.size(); i < n; ++i) {
|
||||||
}
|
Res |= instrumentAtomic(AtomicAccesses[i]);
|
||||||
|
}
|
||||||
|
|
||||||
// Instrument function entry/exit points if there were instrumented accesses.
|
// Instrument function entry/exit points if there were instrumented accesses.
|
||||||
if (Res || HasCalls) {
|
if ((Res || HasCalls) && ClInstrumentFuncEntryExit) {
|
||||||
IRBuilder<> IRB(F.getEntryBlock().getFirstNonPHI());
|
IRBuilder<> IRB(F.getEntryBlock().getFirstNonPHI());
|
||||||
Value *ReturnAddress = IRB.CreateCall(
|
Value *ReturnAddress = IRB.CreateCall(
|
||||||
Intrinsic::getDeclaration(F.getParent(), Intrinsic::returnaddress),
|
Intrinsic::getDeclaration(F.getParent(), Intrinsic::returnaddress),
|
||||||
|
Reference in New Issue
Block a user