summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/Interpreter/Execution.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-08 17:25:49 +0000
committerChris Lattner <sabre@nondot.org>2008-07-08 17:25:49 +0000
commit663ceeb948c526c705b38efd2075b7c80a190e5d (patch)
tree6671effb61ca027fd8af6286d60e0b35f133f487 /lib/ExecutionEngine/Interpreter/Execution.cpp
parent710429645ac0327dbe83ceab040fe04d2cfff605 (diff)
downloadllvm-663ceeb948c526c705b38efd2075b7c80a190e5d.tar.gz
llvm-663ceeb948c526c705b38efd2075b7c80a190e5d.tar.bz2
llvm-663ceeb948c526c705b38efd2075b7c80a190e5d.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53241 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/Interpreter/Execution.cpp')
-rw-r--r--lib/ExecutionEngine/Interpreter/Execution.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp
index d05e8d010c..29837ffcfe 100644
--- a/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/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;
}
//===----------------------------------------------------------------------===//