1 //===- ProfileInfoLoader.h - Load & convert profile information -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
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.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_ANALYSIS_PROFILEINFOLOADER_H
17 #define LLVM_ANALYSIS_PROFILEINFOLOADER_H
29 class ProfileInfoLoader {
31 std::vector<std::string> CommandLines;
32 std::vector<unsigned> FunctionCounts;
33 std::vector<unsigned> BlockCounts;
35 // ProfileInfoLoader ctor - Read the specified profiling data file, exiting
36 // the program if the file is invalid or broken.
37 ProfileInfoLoader(const char *ToolName, const std::string &Filename,
40 unsigned getNumExecutions() const { return CommandLines.size(); }
41 const std::string &getExecution(unsigned i) const { return CommandLines[i]; }
43 // getFunctionCounts - This method is used by consumers of function counting
44 // information. If we do not directly have function count information, we
45 // compute it from other, more refined, types of profile information.
47 void getFunctionCounts(std::vector<std::pair<Function*, unsigned> > &Counts);
49 // hasAccurateBlockCounts - Return true if we can synthesize accurate block
50 // frequency information from whatever we have.
52 bool hasAccurateBlockCounts() const {
53 return !BlockCounts.empty();
56 // getBlockCounts - This method is used by consumers of block counting
57 // information. If we do not directly have block count information, we
58 // compute it from other, more refined, types of profile information.
60 void getBlockCounts(std::vector<std::pair<BasicBlock*, unsigned> > &Counts);
63 } // End llvm namespace