diff options
author | Chris Lattner <sabre@nondot.org> | 2008-07-08 17:25:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-07-08 17:25:49 +0000 |
commit | 2528d63ba77642cb0d6a6a1229031fbc2007d556 (patch) | |
tree | 740bdd057ab3f2cebe3130a4949b44de6af6e82f /llvm/lib/ExecutionEngine/Interpreter | |
parent | 501d78fdc00d8e582f4296a3fd484c95d7b42f60 (diff) | |
download | bcm5719-llvm-2528d63ba77642cb0d6a6a1229031fbc2007d556.tar.gz bcm5719-llvm-2528d63ba77642cb0d6a6a1229031fbc2007d556.zip |
Add a new hidden option to the interpreter to cause it to print
out every volatile load and store. This is useful for tracking
down insane volatile memory bugs.
llvm-svn: 53241
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter')
-rw-r--r-- | llvm/lib/ExecutionEngine/Interpreter/Execution.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp index d05e8d010c1..29837ffcfec 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -21,6 +21,7 @@ #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/ADT/APInt.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" #include <algorithm> @@ -31,6 +32,9 @@ using namespace llvm; STATISTIC(NumDynamicInsts, "Number of dynamic instructions executed"); static Interpreter *TheEE = 0; +static cl::opt<bool> PrintVolatile("interpreter-print-volatile", cl::Hidden, + cl::desc("make the interpreter print every volatile load and store")); + //===----------------------------------------------------------------------===// // Various Helper Functions //===----------------------------------------------------------------------===// @@ -830,6 +834,8 @@ void Interpreter::visitLoadInst(LoadInst &I) { GenericValue Result; LoadValueFromMemory(Result, Ptr, I.getType()); SetValue(&I, Result, SF); + if (I.isVolatile() && PrintVolatile) + cerr << "Volatile load " << I; } void Interpreter::visitStoreInst(StoreInst &I) { @@ -838,6 +844,8 @@ void Interpreter::visitStoreInst(StoreInst &I) { GenericValue SRC = getOperandValue(I.getPointerOperand(), SF); StoreValueToMemory(Val, (GenericValue *)GVTOP(SRC), I.getOperand(0)->getType()); + if (I.isVolatile() && PrintVolatile) + cerr << "Volatile store: " << I; } //===----------------------------------------------------------------------===// |