mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-28 07:17:32 +00:00
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
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
||||||
#include "llvm/ADT/APInt.h"
|
#include "llvm/ADT/APInt.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -31,6 +32,9 @@ using namespace llvm;
|
|||||||
STATISTIC(NumDynamicInsts, "Number of dynamic instructions executed");
|
STATISTIC(NumDynamicInsts, "Number of dynamic instructions executed");
|
||||||
static Interpreter *TheEE = 0;
|
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
|
// Various Helper Functions
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@@ -830,6 +834,8 @@ void Interpreter::visitLoadInst(LoadInst &I) {
|
|||||||
GenericValue Result;
|
GenericValue Result;
|
||||||
LoadValueFromMemory(Result, Ptr, I.getType());
|
LoadValueFromMemory(Result, Ptr, I.getType());
|
||||||
SetValue(&I, Result, SF);
|
SetValue(&I, Result, SF);
|
||||||
|
if (I.isVolatile() && PrintVolatile)
|
||||||
|
cerr << "Volatile load " << I;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Interpreter::visitStoreInst(StoreInst &I) {
|
void Interpreter::visitStoreInst(StoreInst &I) {
|
||||||
@@ -838,6 +844,8 @@ void Interpreter::visitStoreInst(StoreInst &I) {
|
|||||||
GenericValue SRC = getOperandValue(I.getPointerOperand(), SF);
|
GenericValue SRC = getOperandValue(I.getPointerOperand(), SF);
|
||||||
StoreValueToMemory(Val, (GenericValue *)GVTOP(SRC),
|
StoreValueToMemory(Val, (GenericValue *)GVTOP(SRC),
|
||||||
I.getOperand(0)->getType());
|
I.getOperand(0)->getType());
|
||||||
|
if (I.isVolatile() && PrintVolatile)
|
||||||
|
cerr << "Volatile store: " << I;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
Reference in New Issue
Block a user