Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame^] | 1 | //===- ProfileInfoLoaderPass.cpp - LLVM Pass to load profile info ---------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements a concrete implementation of profiling information that |
| 11 | // loads the information from a profile dump file. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #include "llvm/Pass.h" |
| 16 | #include "llvm/Analysis/ProfileInfo.h" |
| 17 | #include "llvm/Analysis/ProfileInfoLoader.h" |
| 18 | using namespace llvm; |
| 19 | |
| 20 | namespace { |
| 21 | class LoaderPass : public Pass, public ProfileInfo { |
| 22 | std::string Filename; |
| 23 | public: |
| 24 | LoaderPass(const std::string &filename = "llvmprof.out") |
| 25 | : Filename(filename) {} |
| 26 | |
| 27 | virtual void getAnalysisUsage(AnalysisUsage &AU) const { |
| 28 | AU.setPreservesAll(); |
| 29 | } |
| 30 | |
| 31 | virtual const char *getPassName() const { |
| 32 | return "Profiling information loader"; |
| 33 | } |
| 34 | |
| 35 | /// run - Load the profile information from the specified file. |
| 36 | virtual bool run(Module &M); |
| 37 | |
| 38 | unsigned getExecutionCount(BasicBlock *BB) { return 0; } |
| 39 | }; |
| 40 | |
| 41 | RegisterOpt<LoaderPass> |
| 42 | X("profile-loader", "Load profile information from llvmprof.out"); |
| 43 | |
| 44 | RegisterAnalysisGroup<ProfileInfo, LoaderPass> Y; |
| 45 | } // End of anonymous namespace |
| 46 | |
| 47 | |
| 48 | /// createProfileLoaderPass - This function returns a Pass that loads the |
| 49 | /// profiling information for the module from the specified filename, making it |
| 50 | /// available to the optimizers. |
| 51 | Pass *llvm::createProfileLoaderPass(const std::string &Filename) { |
| 52 | return new LoaderPass(Filename); |
| 53 | } |
| 54 | |
| 55 | bool LoaderPass::run(Module &M) { |
| 56 | |
| 57 | return false; |
| 58 | } |