2004-02-11 05:54:25 +00:00
|
|
|
//===- ProfileInfoLoader.h - Load & convert profile information -*- C++ -*-===//
|
2005-04-21 20:19:05 +00:00
|
|
|
//
|
2004-02-11 05:54:25 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 19:59:42 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 20:19:05 +00:00
|
|
|
//
|
2004-02-11 05:54:25 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// The ProfileInfoLoader class is used to load and represent profiling
|
|
|
|
// information read in from the dump file. If conversions between formats are
|
|
|
|
// needed, it can also do this.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_ANALYSIS_PROFILEINFOLOADER_H
|
|
|
|
#define LLVM_ANALYSIS_PROFILEINFOLOADER_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <utility>
|
2012-12-03 17:02:12 +00:00
|
|
|
#include <vector>
|
2004-02-11 05:54:25 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class Module;
|
|
|
|
class Function;
|
|
|
|
class BasicBlock;
|
|
|
|
|
|
|
|
class ProfileInfoLoader {
|
2009-08-05 15:55:56 +00:00
|
|
|
const std::string &Filename;
|
2004-02-11 05:54:25 +00:00
|
|
|
std::vector<std::string> CommandLines;
|
|
|
|
std::vector<unsigned> FunctionCounts;
|
|
|
|
std::vector<unsigned> BlockCounts;
|
2004-03-08 18:19:37 +00:00
|
|
|
std::vector<unsigned> EdgeCounts;
|
2009-09-01 19:08:51 +00:00
|
|
|
std::vector<unsigned> OptimalEdgeCounts;
|
2004-05-04 17:11:13 +00:00
|
|
|
std::vector<unsigned> BBTrace;
|
2004-02-11 05:54:25 +00:00
|
|
|
public:
|
|
|
|
// ProfileInfoLoader ctor - Read the specified profiling data file, exiting
|
|
|
|
// the program if the file is invalid or broken.
|
2012-06-06 19:47:08 +00:00
|
|
|
ProfileInfoLoader(const char *ToolName, const std::string &Filename);
|
2004-02-11 05:54:25 +00:00
|
|
|
|
2009-09-16 11:35:50 +00:00
|
|
|
static const unsigned Uncounted;
|
|
|
|
|
2004-02-11 05:54:25 +00:00
|
|
|
unsigned getNumExecutions() const { return CommandLines.size(); }
|
|
|
|
const std::string &getExecution(unsigned i) const { return CommandLines[i]; }
|
|
|
|
|
2009-08-05 15:55:56 +00:00
|
|
|
const std::string &getFileName() const { return Filename; }
|
2004-02-11 05:54:25 +00:00
|
|
|
|
2009-08-05 15:55:56 +00:00
|
|
|
// getRawFunctionCounts - This method is used by consumers of function
|
|
|
|
// counting information.
|
2004-02-11 05:54:25 +00:00
|
|
|
//
|
2009-08-05 15:55:56 +00:00
|
|
|
const std::vector<unsigned> &getRawFunctionCounts() const {
|
|
|
|
return FunctionCounts;
|
2004-03-08 18:19:37 +00:00
|
|
|
}
|
|
|
|
|
2009-08-05 15:55:56 +00:00
|
|
|
// getRawBlockCounts - This method is used by consumers of block counting
|
|
|
|
// information.
|
2004-03-08 18:19:37 +00:00
|
|
|
//
|
2009-08-05 15:55:56 +00:00
|
|
|
const std::vector<unsigned> &getRawBlockCounts() const {
|
|
|
|
return BlockCounts;
|
2004-02-11 05:54:25 +00:00
|
|
|
}
|
|
|
|
|
2004-03-08 18:19:37 +00:00
|
|
|
// getEdgeCounts - This method is used by consumers of edge counting
|
2004-05-04 17:11:13 +00:00
|
|
|
// information.
|
|
|
|
//
|
2009-08-05 15:55:56 +00:00
|
|
|
const std::vector<unsigned> &getRawEdgeCounts() const {
|
|
|
|
return EdgeCounts;
|
|
|
|
}
|
2009-09-01 19:08:51 +00:00
|
|
|
|
|
|
|
// getEdgeOptimalCounts - This method is used by consumers of optimal edge
|
|
|
|
// counting information.
|
|
|
|
//
|
|
|
|
const std::vector<unsigned> &getRawOptimalEdgeCounts() const {
|
|
|
|
return OptimalEdgeCounts;
|
|
|
|
}
|
|
|
|
|
2004-02-11 05:54:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|