blob: eab9bc9781c323d248268d1237e5c440b5205108 [file] [log] [blame]
Chris Lattnere4367792003-10-28 20:13:07 +00001//===- ProfileInfo.h - Represents profile information -----------*- C++ -*-===//
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// The ProfileInfo class is used to represent profiling information read in from
11// the dump file.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef PROFILEINFO_H
16#define PROFILEINFO_H
17
18#include <vector>
19#include <string>
Chris Lattner7a78d812003-10-28 21:08:18 +000020#include <utility>
21class Module;
22class Function;
Chris Lattner33f1ca72003-10-28 21:25:23 +000023class BasicBlock;
Chris Lattnere4367792003-10-28 20:13:07 +000024
25class ProfileInfo {
Chris Lattner7a78d812003-10-28 21:08:18 +000026 Module &M;
Chris Lattnere4367792003-10-28 20:13:07 +000027 std::vector<std::string> CommandLines;
28 std::vector<unsigned> FunctionCounts;
29 std::vector<unsigned> BlockCounts;
30public:
31 // ProfileInfo ctor - Read the specified profiling data file, exiting the
32 // program if the file is invalid or broken.
Chris Lattner7a78d812003-10-28 21:08:18 +000033 ProfileInfo(const char *ToolName, const std::string &Filename, Module &M);
34
35 // getFunctionCounts - This method is used by consumers of function counting
36 // information. If we do not directly have function count information, we
37 // compute it from other, more refined, types of profile information.
38 //
39 void getFunctionCounts(std::vector<std::pair<Function*, unsigned> > &Counts);
40
Chris Lattner33f1ca72003-10-28 21:25:23 +000041 // hasAccurateBlockCounts - Return true if we can synthesize accurate block
42 // frequency information from whatever we have.
43 //
44 bool hasAccurateBlockCounts() const {
45 return !BlockCounts.empty();
46 }
47
48 // getBlockCounts - This method is used by consumers of block counting
49 // information. If we do not directly have block count information, we
50 // compute it from other, more refined, types of profile information.
51 //
52 void getBlockCounts(std::vector<std::pair<BasicBlock*, unsigned> > &Counts);
Chris Lattnere4367792003-10-28 20:13:07 +000053};
54
55#endif