forked from OSchip/llvm-project
Move ProfilePaths class into ProfilePaths library, only expose a creation function
llvm-svn: 1812
This commit is contained in:
parent
d7291473cf
commit
d209550828
|
@ -27,17 +27,11 @@
|
||||||
#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_PROFILE_PATHS_H
|
#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_PROFILE_PATHS_H
|
||||||
#define LLVM_TRANSFORMS_INSTRUMENTATION_PROFILE_PATHS_H
|
#define LLVM_TRANSFORMS_INSTRUMENTATION_PROFILE_PATHS_H
|
||||||
|
|
||||||
#include "llvm/Pass.h"
|
class Pass;
|
||||||
|
|
||||||
class ProfilePaths: public MethodPass {
|
// createProfilePathsPass - Create a new pass to add path profiling
|
||||||
public:
|
//
|
||||||
bool runOnMethod(Method *M);
|
Pass *createProfilePathsPass();
|
||||||
|
|
||||||
// getAnalysisUsageInfo - transform cfg to have just one exit node
|
|
||||||
virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
|
|
||||||
Pass::AnalysisSet &Destroyed,
|
|
||||||
Pass::AnalysisSet &Provided);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,32 @@
|
||||||
#include "llvm/ConstantVals.h"
|
#include "llvm/ConstantVals.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/iMemory.h"
|
#include "llvm/iMemory.h"
|
||||||
|
#include "llvm/Pass.h"
|
||||||
#include "Graph.h"
|
#include "Graph.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
|
class ProfilePaths: public MethodPass {
|
||||||
|
public:
|
||||||
|
bool runOnMethod(Method *M);
|
||||||
|
|
||||||
|
// Before this pass, make sure that there is only one
|
||||||
|
// entry and only one exit node for the method in the CFG of the method
|
||||||
|
//
|
||||||
|
void ProfilePaths::getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
|
||||||
|
Pass::AnalysisSet &Destroyed,
|
||||||
|
Pass::AnalysisSet &Provided) {
|
||||||
|
Requires.push_back(UnifyMethodExitNodes::ID);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// createProfilePathsPass - Create a new pass to add path profiling
|
||||||
|
//
|
||||||
|
Pass *createProfilePathsPass() {
|
||||||
|
return new ProfilePaths();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static Node *findBB(std::set<Node *> &st, BasicBlock *BB){
|
static Node *findBB(std::set<Node *> &st, BasicBlock *BB){
|
||||||
for(std::set<Node *>::iterator si=st.begin(); si!=st.end(); ++si){
|
for(std::set<Node *>::iterator si=st.begin(); si!=st.end(); ++si){
|
||||||
if(((*si)->getElement())==BB){
|
if(((*si)->getElement())==BB){
|
||||||
|
@ -145,18 +167,3 @@ bool ProfilePaths::runOnMethod(Method *M){
|
||||||
|
|
||||||
return true; // Always modifies method
|
return true; // Always modifies method
|
||||||
}
|
}
|
||||||
|
|
||||||
//Before this pass, make sure that there is only one
|
|
||||||
//entry and only one exit node for the method in the CFG of the method
|
|
||||||
void ProfilePaths::getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
|
|
||||||
Pass::AnalysisSet &Destroyed,
|
|
||||||
Pass::AnalysisSet &Provided) {
|
|
||||||
Requires.push_back(UnifyMethodExitNodes::ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -100,9 +100,11 @@ struct {
|
||||||
|
|
||||||
{ trace , New<InsertTraceCode, bool, true, bool, true> },
|
{ trace , New<InsertTraceCode, bool, true, bool, true> },
|
||||||
{ tracem , New<InsertTraceCode, bool, false, bool, true> },
|
{ tracem , New<InsertTraceCode, bool, false, bool, true> },
|
||||||
{ paths , New<ProfilePaths> },
|
{ paths , createProfilePathsPass },
|
||||||
|
|
||||||
{ print , NewPrintMethodPass },
|
{ print , NewPrintMethodPass },
|
||||||
{ verify , createVerifierPass },
|
{ verify , createVerifierPass },
|
||||||
|
|
||||||
{ raiseallocs, New<RaiseAllocations> },
|
{ raiseallocs, New<RaiseAllocations> },
|
||||||
{ cleangcc , New<CleanupGCCOutput> },
|
{ cleangcc , New<CleanupGCCOutput> },
|
||||||
{ globaldce , New<GlobalDCE> },
|
{ globaldce , New<GlobalDCE> },
|
||||||
|
|
Loading…
Reference in New Issue