X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTransforms%2FInstrumentation%2FEdgeProfiling.cpp;h=e8ef2654d2564ff8268db778b8a62f19e7c24c46;hb=22689b6034dbde1c08e39b162fd59e1fd5d35b96;hp=e5cd1f0ef423b20e140a2705996404901cf08d1d;hpb=d13db2c59cc94162d6cf0a04187d408bfef6d4a7;p=oota-llvm.git diff --git a/lib/Transforms/Instrumentation/EdgeProfiling.cpp b/lib/Transforms/Instrumentation/EdgeProfiling.cpp index e5cd1f0ef42..e8ef2654d25 100644 --- a/lib/Transforms/Instrumentation/EdgeProfiling.cpp +++ b/lib/Transforms/Instrumentation/EdgeProfiling.cpp @@ -17,6 +17,7 @@ // //===----------------------------------------------------------------------===// #define DEBUG_TYPE "insert-edge-profiling" + #include "ProfilingUtils.h" #include "llvm/Module.h" #include "llvm/Pass.h" @@ -34,7 +35,9 @@ namespace { bool runOnModule(Module &M); public: static char ID; // Pass identification, replacement for typeid - EdgeProfiler() : ModulePass(&ID) {} + EdgeProfiler() : ModulePass(ID) { + initializeEdgeProfilerPass(*PassRegistry::getPassRegistry()); + } virtual const char *getPassName() const { return "Edge Profiler"; @@ -44,7 +47,7 @@ namespace { char EdgeProfiler::ID = 0; INITIALIZE_PASS(EdgeProfiler, "insert-edge-profiling", - "Insert instrumentation for edge profiling", false, false); + "Insert instrumentation for edge profiling", false, false) ModulePass *llvm::createEdgeProfilerPass() { return new EdgeProfiler(); } @@ -71,7 +74,7 @@ bool EdgeProfiler::runOnModule(Module &M) { } } - const Type *ATy = ArrayType::get(Type::getInt32Ty(M.getContext()), NumEdges); + Type *ATy = ArrayType::get(Type::getInt32Ty(M.getContext()), NumEdges); GlobalVariable *Counters = new GlobalVariable(M, ATy, false, GlobalValue::InternalLinkage, Constant::getNullValue(ATy), "EdgeProfCounters"); @@ -98,7 +101,7 @@ bool EdgeProfiler::runOnModule(Module &M) { // otherwise insert it in the successor block. if (TI->getNumSuccessors() == 1) { // Insert counter at the start of the block - IncrementCounterInBlock(BB, i++, Counters); + IncrementCounterInBlock(BB, i++, Counters, false); } else { // Insert counter at the start of the block IncrementCounterInBlock(TI->getSuccessor(s), i++, Counters);