LLVM API Documentation
00001 //===- ProfileInfoLoader.h - Load & convert profile information -*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // The ProfileInfoLoader class is used to load and represent profiling 00011 // information read in from the dump file. If conversions between formats are 00012 // needed, it can also do this. 00013 // 00014 //===----------------------------------------------------------------------===// 00015 00016 #ifndef LLVM_ANALYSIS_PROFILEINFOLOADER_H 00017 #define LLVM_ANALYSIS_PROFILEINFOLOADER_H 00018 00019 #include <vector> 00020 #include <string> 00021 #include <utility> 00022 00023 namespace llvm { 00024 00025 class Module; 00026 class Function; 00027 class BasicBlock; 00028 00029 class ProfileInfoLoader { 00030 const std::string &Filename; 00031 Module &M; 00032 std::vector<std::string> CommandLines; 00033 std::vector<unsigned> FunctionCounts; 00034 std::vector<unsigned> BlockCounts; 00035 std::vector<unsigned> EdgeCounts; 00036 std::vector<unsigned> BBTrace; 00037 bool Warned; 00038 public: 00039 // ProfileInfoLoader ctor - Read the specified profiling data file, exiting 00040 // the program if the file is invalid or broken. 00041 ProfileInfoLoader(const char *ToolName, const std::string &Filename, 00042 Module &M); 00043 00044 unsigned getNumExecutions() const { return CommandLines.size(); } 00045 const std::string &getExecution(unsigned i) const { return CommandLines[i]; } 00046 00047 const std::string &getFileName() const { return Filename; } 00048 00049 // getRawFunctionCounts - This method is used by consumers of function 00050 // counting information. 00051 // 00052 const std::vector<unsigned> &getRawFunctionCounts() const { 00053 return FunctionCounts; 00054 } 00055 00056 // getRawBlockCounts - This method is used by consumers of block counting 00057 // information. 00058 // 00059 const std::vector<unsigned> &getRawBlockCounts() const { 00060 return BlockCounts; 00061 } 00062 00063 // getEdgeCounts - This method is used by consumers of edge counting 00064 // information. 00065 // 00066 const std::vector<unsigned> &getRawEdgeCounts() const { 00067 return EdgeCounts; 00068 } 00069 }; 00070 00071 } // End llvm namespace 00072 00073 #endif