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