From: Jeff Cohen Date: Fri, 7 Jan 2005 06:57:28 +0000 (+0000) Subject: Add missing createXxxPass functions X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d9ed8c888016d15eded298c25bc8bdeffcb8d155;p=oota-llvm.git Add missing createXxxPass functions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19319 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Transforms/Instrumentation.h b/include/llvm/Transforms/Instrumentation.h index 869f9d05d6c..f6aff42d682 100644 --- a/include/llvm/Transforms/Instrumentation.h +++ b/include/llvm/Transforms/Instrumentation.h @@ -28,6 +28,20 @@ FunctionPass *createCombineBranchesPass(); // Reoptimizer support pass: emit table of global functions ModulePass *createEmitFunctionTablePass (); +// Reoptimizer support pass: insert function profiling instrumentation +ModulePass *createFunctionProfilerPass(); + +// Reoptimizer support pass: insert block profiling instrumentation +ModulePass *createBlockProfilerPass(); + +// Reoptimizer support pass: insert edge profiling instrumentation +ModulePass *createEdgeProfilerPass(); + +// Reoptimizer support pass: insert basic block tracing instrumentation +ModulePass *createTraceBasicBlockPass(); + +// Reoptimizer support pass: insert counting of execute paths instrumentation +FunctionPass *createProfilePathsPass(); //===----------------------------------------------------------------------===// // Support for inserting LLVM code to print values at basic block and function diff --git a/include/llvm/Transforms/LinkAllPasses.h b/include/llvm/Transforms/LinkAllPasses.h index 9d27437ea8a..15ac307e769 100644 --- a/include/llvm/Transforms/LinkAllPasses.h +++ b/include/llvm/Transforms/LinkAllPasses.h @@ -40,11 +40,9 @@ namespace { std::vector bbv; - // The commented out calls below refer to non-existent creation - // functions. They will be uncommented as the functions are added. - (void) llvm::createAggressiveDCEPass(); (void) llvm::createArgumentPromotionPass(); + (void) llvm::createBlockProfilerPass(); (void) llvm::createBreakCriticalEdgesPass(); (void) llvm::createCFGSimplificationPass(); (void) llvm::createCombineBranchesPass(); @@ -56,8 +54,10 @@ namespace { (void) llvm::createDeadInstEliminationPass(); (void) llvm::createDeadStoreEliminationPass(); (void) llvm::createDeadTypeEliminationPass(); + (void) llvm::createEdgeProfilerPass(); (void) llvm::createEmitFunctionTablePass(); (void) llvm::createFunctionInliningPass(); + (void) llvm::createFunctionProfilerPass(); (void) llvm::createFunctionResolvingPass(); (void) llvm::createGCSEPass(); (void) llvm::createGlobalDCEPass(); @@ -74,11 +74,13 @@ namespace { (void) llvm::createLoopUnrollPass(); (void) llvm::createLoopUnswitchPass(); (void) llvm::createLowerAllocationsPass(); + (void) llvm::createLowerConstantExpressionsPass(); (void) llvm::createLowerGCPass(); (void) llvm::createLowerInvokePass(); (void) llvm::createLowerPackedPass(); (void) llvm::createLowerSetJmpPass(); (void) llvm::createLowerSwitchPass(); + (void) llvm::createProfilePathsPass(); (void) llvm::createPromoteMemoryToRegister(); (void) llvm::createPruneEHPass(); (void) llvm::createRaiseAllocationsPass(); @@ -89,6 +91,7 @@ namespace { (void) llvm::createSingleLoopExtractorPass(); (void) llvm::createTailCallEliminationPass(); (void) llvm::createTailDuplicationPass(); + (void) llvm::createTraceBasicBlockPass(); (void) llvm::createTraceValuesPassForBasicBlocks(); (void) llvm::createTraceValuesPassForFunction(); } diff --git a/lib/Transforms/Instrumentation/BlockProfiling.cpp b/lib/Transforms/Instrumentation/BlockProfiling.cpp index f22f81feeff..ef1df23e8bc 100644 --- a/lib/Transforms/Instrumentation/BlockProfiling.cpp +++ b/lib/Transforms/Instrumentation/BlockProfiling.cpp @@ -23,6 +23,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/Module.h" #include "llvm/Pass.h" +#include "llvm/Transforms/Instrumentation.h" #include "ProfilingUtils.h" #include @@ -37,6 +38,11 @@ namespace { "Insert instrumentation for function profiling"); } +ModulePass *llvm::createFunctionProfilerPass() +{ + return new FunctionProfiler(); +} + bool FunctionProfiler::runOnModule(Module &M) { Function *Main = M.getMainFunction(); if (Main == 0) { @@ -77,6 +83,8 @@ namespace { "Insert instrumentation for block profiling"); } +ModulePass *llvm::createBlockProfilerPass() { return new BlockProfiler(); } + bool BlockProfiler::runOnModule(Module &M) { Function *Main = M.getMainFunction(); if (Main == 0) { diff --git a/lib/Transforms/Instrumentation/EdgeProfiling.cpp b/lib/Transforms/Instrumentation/EdgeProfiling.cpp index 89c540c5bcd..c453554236e 100644 --- a/lib/Transforms/Instrumentation/EdgeProfiling.cpp +++ b/lib/Transforms/Instrumentation/EdgeProfiling.cpp @@ -22,6 +22,7 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" +#include "llvm/Transforms/Instrumentation.h" #include "ProfilingUtils.h" #include #include @@ -36,6 +37,8 @@ namespace { "Insert instrumentation for edge profiling"); } +ModulePass *llvm::createEdgeProfilerPass() { return new EdgeProfiler(); } + bool EdgeProfiler::runOnModule(Module &M) { Function *Main = M.getMainFunction(); if (Main == 0) { diff --git a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp index aa0723bd4ab..cc14c268e06 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp @@ -31,6 +31,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" #include "llvm/Support/CFG.h" #include "llvm/Constants.h" @@ -56,6 +57,8 @@ struct ProfilePaths : public FunctionPass { static RegisterOpt X("paths", "Profile Paths"); +FunctionPass *createProfilePathsPass() { return new ProfilePaths(); } + static Node *findBB(std::vector &st, BasicBlock *BB){ for(std::vector::iterator si=st.begin(); si!=st.end(); ++si){ if(((*si)->getElement())==BB){ diff --git a/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp b/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp index 746e82221ad..68d50ae5596 100644 --- a/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp +++ b/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp @@ -18,6 +18,7 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" +#include "llvm/Transforms/Instrumentation.h" #include "llvm/Instructions.h" #include "ProfilingUtils.h" #include "llvm/Support/Debug.h" @@ -33,6 +34,11 @@ namespace { "Insert instrumentation for basic block tracing"); } +ModulePass *llvm::createTraceBasicBlockPass() +{ + return new TraceBasicBlocks(); +} + static void InsertInstrumentationCall (BasicBlock *BB, const std::string FnName, unsigned BBNumber) {