1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-24 05:23:45 +02:00
llvm-mirror/include/llvm/Analysis/PathProfileInfo.h
Chandler Carruth 4c1f3c24db Move all of the header files which are involved in modelling the LLVM IR
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.

There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.

The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.

I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).

I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.

llvm-svn: 171366
2013-01-02 11:36:10 +00:00

113 lines
3.1 KiB
C++

//===- PathProfileInfo.h --------------------------------------*- C++ -*---===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file outlines the interface used by optimizers to load path profiles.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_PATHPROFILEINFO_H
#define LLVM_PATHPROFILEINFO_H
#include "llvm/Analysis/PathNumbering.h"
#include "llvm/IR/BasicBlock.h"
namespace llvm {
class ProfilePath;
class ProfilePathEdge;
class PathProfileInfo;
typedef std::vector<ProfilePathEdge> ProfilePathEdgeVector;
typedef std::vector<ProfilePathEdge>::iterator ProfilePathEdgeIterator;
typedef std::vector<BasicBlock*> ProfilePathBlockVector;
typedef std::vector<BasicBlock*>::iterator ProfilePathBlockIterator;
typedef std::map<unsigned int,ProfilePath*> ProfilePathMap;
typedef std::map<unsigned int,ProfilePath*>::iterator ProfilePathIterator;
typedef std::map<Function*,unsigned int> FunctionPathCountMap;
typedef std::map<Function*,ProfilePathMap> FunctionPathMap;
typedef std::map<Function*,ProfilePathMap>::iterator FunctionPathIterator;
class ProfilePathEdge {
public:
ProfilePathEdge(BasicBlock* source, BasicBlock* target,
unsigned duplicateNumber);
inline unsigned getDuplicateNumber() { return _duplicateNumber; }
inline BasicBlock* getSource() { return _source; }
inline BasicBlock* getTarget() { return _target; }
protected:
BasicBlock* _source;
BasicBlock* _target;
unsigned _duplicateNumber;
};
class ProfilePath {
public:
ProfilePath(unsigned int number, unsigned int count,
double countStdDev, PathProfileInfo* ppi);
double getFrequency() const;
inline unsigned int getNumber() const { return _number; }
inline unsigned int getCount() const { return _count; }
inline double getCountStdDev() const { return _countStdDev; }
ProfilePathEdgeVector* getPathEdges() const;
ProfilePathBlockVector* getPathBlocks() const;
BasicBlock* getFirstBlockInPath() const;
private:
unsigned int _number;
unsigned int _count;
double _countStdDev;
// double pointer back to the profiling info
PathProfileInfo* _ppi;
};
// TODO: overload [] operator for getting path
// Add: getFunctionCallCount()
class PathProfileInfo {
public:
PathProfileInfo();
~PathProfileInfo();
void setCurrentFunction(Function* F);
Function* getCurrentFunction() const;
BasicBlock* getCurrentFunctionEntry();
ProfilePath* getPath(unsigned int number);
unsigned int getPotentialPathCount();
ProfilePathIterator pathBegin();
ProfilePathIterator pathEnd();
unsigned int pathsRun();
static char ID; // Pass identification
std::string argList;
protected:
FunctionPathMap _functionPaths;
FunctionPathCountMap _functionPathCounts;
private:
BallLarusDag* _currentDag;
Function* _currentFunction;
friend class ProfilePath;
};
} // end namespace llvm
#endif