diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-05-16 02:05:13 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-05-16 02:05:13 +0000 |
commit | 951418b7e9e109bb4330d2e901a553aad69637c8 (patch) | |
tree | 50d44f3a7dbe062ac712b2d3c3533c61d12ff2f8 /lib/ExecutionEngine/Interpreter | |
parent | 93003b8cf221f084e71e2b4033c41ff2cae6c36d (diff) | |
download | external_llvm-951418b7e9e109bb4330d2e901a553aad69637c8.zip external_llvm-951418b7e9e109bb4330d2e901a553aad69637c8.tar.gz external_llvm-951418b7e9e109bb4330d2e901a553aad69637c8.tar.bz2 |
Implement printing of instruction result values when debug info is turned
on. This helps to speed up the debugging time by showing computational
results as the program executes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37095 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/Interpreter')
-rw-r--r-- | lib/ExecutionEngine/Interpreter/Execution.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp index 4d6c0db..8231001 100644 --- a/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -1338,6 +1338,20 @@ void Interpreter::callFunction(Function *F, StackFrame.VarArgs.assign(ArgVals.begin()+i, ArgVals.end()); } +static void PrintGenericValue(const GenericValue &Val, const Type* Ty) { + switch (Ty->getTypeID()) { + default: assert(0 && "Invalid GenericValue Type"); + case Type::VoidTyID: DOUT << "void"; break; + case Type::FloatTyID: DOUT << "float " << Val.FloatVal; break; + case Type::DoubleTyID: DOUT << "double " << Val.DoubleVal; break; + case Type::PointerTyID: DOUT << "void* " << unsigned(Val.PointerVal); break; + case Type::IntegerTyID: + DOUT << "i" << Val.IntVal.getBitWidth() << " " << Val.IntVal.toString(10) + << "\n"; + break; + } +} + void Interpreter::run() { while (!ECStack.empty()) { // Interpret a single instruction & increment the "PC". @@ -1349,5 +1363,12 @@ void Interpreter::run() { DOUT << "About to interpret: " << I; visit(I); // Dispatch to one of the visit* methods... +#ifndef NDEBUG + if (!isa<CallInst>(I) && !isa<InvokeInst>(I) && + I.getType() != Type::VoidTy) { + DOUT << " --> "; + PrintGenericValue(SF.Values[&I], I.getType()); + } +#endif } } |