[llvm-commits] [llvm] r53241 - /llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp
Chris Lattner
sabre at nondot.org
Tue Jul 8 10:26:13 PDT 2008
Author: lattner
Date: Tue Jul 8 12:25:49 2008
New Revision: 53241
URL: http://llvm.org/viewvc/llvm-project?rev=53241&view=rev
Log:
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.
Modified:
llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp
Modified: llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp?rev=53241&r1=53240&r2=53241&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp Tue Jul 8 12:25:49 2008
@@ -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 @@
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 @@
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 @@
GenericValue SRC = getOperandValue(I.getPointerOperand(), SF);
StoreValueToMemory(Val, (GenericValue *)GVTOP(SRC),
I.getOperand(0)->getType());
+ if (I.isVolatile() && PrintVolatile)
+ cerr << "Volatile store: " << I;
}
//===----------------------------------------------------------------------===//
More information about the llvm-commits
mailing list