Changes in directory llvm/lib/ExecutionEngine/Interpreter:
Execution.cpp updated: 1.181 -> 1.182 --- Log message: 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. --- Diffs of the changes: (+21 -0) Execution.cpp | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.181 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.182 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.181 Thu May 3 22:37:38 2007 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Tue May 15 21:05:13 2007 @@ -1338,6 +1338,20 @@ 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 @@ 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 } } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits