1 //===- ProfileInfoLoader.h - Load & convert profile information -*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // The ProfileInfoLoader class is used to load and represent profiling 11 // information read in from the dump file. If conversions between formats are 12 // needed, it can also do this. 13 // 14 //===----------------------------------------------------------------------===// 15 16 #ifndef LLVM_ANALYSIS_PROFILEINFOLOADER_H 17 #define LLVM_ANALYSIS_PROFILEINFOLOADER_H 18 19 #include <string> 20 #include <utility> 21 #include <vector> 22 23 namespace llvm { 24 25 class Module; 26 class Function; 27 class BasicBlock; 28 29 class ProfileInfoLoader { 30 const std::string &Filename; 31 std::vector<std::string> CommandLines; 32 std::vector<unsigned> FunctionCounts; 33 std::vector<unsigned> BlockCounts; 34 std::vector<unsigned> EdgeCounts; 35 std::vector<unsigned> OptimalEdgeCounts; 36 std::vector<unsigned> BBTrace; 37 public: 38 // ProfileInfoLoader ctor - Read the specified profiling data file, exiting 39 // the program if the file is invalid or broken. 40 ProfileInfoLoader(const char *ToolName, const std::string &Filename); 41 42 static const unsigned Uncounted; 43 getNumExecutions()44 unsigned getNumExecutions() const { return CommandLines.size(); } getExecution(unsigned i)45 const std::string &getExecution(unsigned i) const { return CommandLines[i]; } 46 getFileName()47 const std::string &getFileName() const { return Filename; } 48 49 // getRawFunctionCounts - This method is used by consumers of function 50 // counting information. 51 // getRawFunctionCounts()52 const std::vector<unsigned> &getRawFunctionCounts() const { 53 return FunctionCounts; 54 } 55 56 // getRawBlockCounts - This method is used by consumers of block counting 57 // information. 58 // getRawBlockCounts()59 const std::vector<unsigned> &getRawBlockCounts() const { 60 return BlockCounts; 61 } 62 63 // getEdgeCounts - This method is used by consumers of edge counting 64 // information. 65 // getRawEdgeCounts()66 const std::vector<unsigned> &getRawEdgeCounts() const { 67 return EdgeCounts; 68 } 69 70 // getEdgeOptimalCounts - This method is used by consumers of optimal edge 71 // counting information. 72 // getRawOptimalEdgeCounts()73 const std::vector<unsigned> &getRawOptimalEdgeCounts() const { 74 return OptimalEdgeCounts; 75 } 76 77 }; 78 79 } // End llvm namespace 80 81 #endif 82