From f525e2f95e521b6a7e539783c1b0297d3b6d6426 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 8 Dec 2002 05:51:08 +0000 Subject: [PATCH] Add support to count the number of dynamic instructions executed by LLI llvm-svn: 4955 --- lib/ExecutionEngine/Interpreter/Execution.cpp | 8 ++++++++ tools/lli/lli.cpp | 5 +---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp index d11ed6e5218..3d6cf0bfb9c 100644 --- a/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -15,6 +15,7 @@ #include "llvm/Assembly/Writer.h" #include "llvm/Target/TargetData.h" #include "Support/CommandLine.h" +#include "Support/Statistic.h" #include // For fmod #include #include @@ -22,6 +23,10 @@ using std::vector; using std::cout; using std::cerr; +namespace { + Statistic<> NumDynamicInsts("lli", "Number of dynamic instructions executed"); +} + static cl::opt QuietMode("quiet", cl::desc("Do not emit any non-program output")); @@ -1251,6 +1256,9 @@ bool Interpreter::executeInstruction() { if (Trace) CW << "Run:" << I; + // Track the number of dynamic instructions executed. + ++NumDynamicInsts; + // Set a sigsetjmp buffer so that we can recover if an error happens during // instruction execution... // diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index 76e1eb19771..3f718e599e8 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -21,10 +21,7 @@ MainFunction ("f", cl::desc("Function to execute"), cl::init("main"), cl::value_desc("function name")); static cl::opt -DebugMode("debug", cl::desc("Start program in debugger")); - -static cl::alias -DebugModeA("d", cl::desc("Alias for -debug"), cl::aliasopt(DebugMode)); +DebugMode("d", cl::desc("Start program in debugger")); static cl::opt TraceMode("trace", cl::desc("Enable Tracing"));