[llvm-commits] [llvm] r80668 - /llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp
Andreas Neustifter
astifter at gmx.at
Tue Sep 1 03:08:39 PDT 2009
Author: astifter
Date: Tue Sep 1 05:08:39 2009
New Revision: 80668
URL: http://llvm.org/viewvc/llvm-project?rev=80668&view=rev
Log:
Preparation for Optimal Edge Profiling:
Add statistics for regular edge profiling, this enables the comparation of the
number of edges inserted by regular and optimal edge profiling.
Modified:
llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp
Modified: llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp?rev=80668&r1=80667&r2=80668&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp Tue Sep 1 05:08:39 2009
@@ -16,7 +16,7 @@
// number of counters inserted.
//
//===----------------------------------------------------------------------===//
-
+#define DEBUG_TYPE "insert-edge-profiling"
#include "ProfilingUtils.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
@@ -24,15 +24,22 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Instrumentation.h"
+#include "llvm/ADT/Statistic.h"
#include <set>
using namespace llvm;
+STATISTIC(NumEdgesInserted, "The # of edges inserted.");
+
namespace {
class VISIBILITY_HIDDEN EdgeProfiler : public ModulePass {
bool runOnModule(Module &M);
public:
static char ID; // Pass identification, replacement for typeid
EdgeProfiler() : ModulePass(&ID) {}
+
+ virtual const char *getPassName() const {
+ return "Edge Profiler";
+ }
};
}
@@ -69,6 +76,7 @@
GlobalVariable *Counters =
new GlobalVariable(M, ATy, false, GlobalValue::InternalLinkage,
Constant::getNullValue(ATy), "EdgeProfCounters");
+ NumEdgesInserted = NumEdges;
// Instrument all of the edges...
unsigned i = 0;
More information about the llvm-commits
mailing list