]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - contrib/llvm/include/llvm/Analysis/ProfileInfoLoader.h
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / contrib / llvm / include / llvm / Analysis / ProfileInfoLoader.h
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 <vector>
20 #include <string>
21 #include <utility>
22
23 namespace llvm {
24
25 class Module;
26 class Function;
27 class BasicBlock;
28
29 class ProfileInfoLoader {
30   const std::string &Filename;
31   Module &M;
32   std::vector<std::string> CommandLines;
33   std::vector<unsigned>    FunctionCounts;
34   std::vector<unsigned>    BlockCounts;
35   std::vector<unsigned>    EdgeCounts;
36   std::vector<unsigned>    OptimalEdgeCounts;
37   std::vector<unsigned>    BBTrace;
38   bool Warned;
39 public:
40   // ProfileInfoLoader ctor - Read the specified profiling data file, exiting
41   // the program if the file is invalid or broken.
42   ProfileInfoLoader(const char *ToolName, const std::string &Filename,
43                     Module &M);
44
45   static const unsigned Uncounted;
46
47   unsigned getNumExecutions() const { return CommandLines.size(); }
48   const std::string &getExecution(unsigned i) const { return CommandLines[i]; }
49
50   const std::string &getFileName() const { return Filename; }
51
52   // getRawFunctionCounts - This method is used by consumers of function
53   // counting information.
54   //
55   const std::vector<unsigned> &getRawFunctionCounts() const {
56     return FunctionCounts;
57   }
58
59   // getRawBlockCounts - This method is used by consumers of block counting
60   // information.
61   //
62   const std::vector<unsigned> &getRawBlockCounts() const {
63     return BlockCounts;
64   }
65
66   // getEdgeCounts - This method is used by consumers of edge counting
67   // information.
68   //
69   const std::vector<unsigned> &getRawEdgeCounts() const {
70     return EdgeCounts;
71   }
72
73   // getEdgeOptimalCounts - This method is used by consumers of optimal edge 
74   // counting information.
75   //
76   const std::vector<unsigned> &getRawOptimalEdgeCounts() const {
77     return OptimalEdgeCounts;
78   }
79
80 };
81
82 } // End llvm namespace
83
84 #endif