forked from OSchip/llvm-project
* Move some code from Pass.cpp to PassManagerT.h
* Implement stuff so that code can declare that they only depend on the CFG of a function, not on anything else. This speeds up GCCAS a lot. llvm-svn: 3155
This commit is contained in:
parent
e87f65ec1b
commit
198cf42178
|
@ -10,7 +10,6 @@
|
||||||
#include "PassManagerT.h" // PassManagerT implementation
|
#include "PassManagerT.h" // PassManagerT implementation
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "Support/STLExtras.h"
|
#include "Support/STLExtras.h"
|
||||||
#include "Support/CommandLine.h"
|
|
||||||
#include "Support/TypeInfo.h"
|
#include "Support/TypeInfo.h"
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -21,21 +20,11 @@
|
||||||
// AnalysisID Class Implementation
|
// AnalysisID Class Implementation
|
||||||
//
|
//
|
||||||
|
|
||||||
static std::vector<AnalysisID> CFGOnlyAnalyses;
|
static std::vector<const PassInfo*> CFGOnlyAnalyses;
|
||||||
#if 0
|
|
||||||
// Source of unique analysis ID #'s.
|
|
||||||
unsigned AnalysisID::NextID = 0;
|
|
||||||
|
|
||||||
AnalysisID::AnalysisID(const AnalysisID &AID, bool DependsOnlyOnCFG) {
|
void RegisterPassBase::setPreservesCFG() {
|
||||||
ID = AID.ID; // Implement the copy ctor part...
|
CFGOnlyAnalyses.push_back(PIObj);
|
||||||
Constructor = AID.Constructor;
|
|
||||||
|
|
||||||
// If this analysis only depends on the CFG of the function, add it to the CFG
|
|
||||||
// only list...
|
|
||||||
if (DependsOnlyOnCFG)
|
|
||||||
CFGOnlyAnalyses.push_back(AID);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// AnalysisResolver Class Implementation
|
// AnalysisResolver Class Implementation
|
||||||
|
@ -137,33 +126,6 @@ TimingInfo::~TimingInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
// Pass debugging information. Often it is useful to find out what pass is
|
|
||||||
// running when a crash occurs in a utility. When this library is compiled with
|
|
||||||
// debugging on, a command line option (--debug-pass) is enabled that causes the
|
|
||||||
// pass name to be printed before it executes.
|
|
||||||
//
|
|
||||||
|
|
||||||
// Different debug levels that can be enabled...
|
|
||||||
enum PassDebugLevel {
|
|
||||||
None, Structure, Executions, Details
|
|
||||||
};
|
|
||||||
|
|
||||||
static cl::opt<enum PassDebugLevel>
|
|
||||||
PassDebugging("debug-pass", cl::Hidden,
|
|
||||||
cl::desc("Print PassManager debugging information"),
|
|
||||||
cl::values(
|
|
||||||
clEnumVal(None , "disable debug output"),
|
|
||||||
// TODO: add option to print out pass names "PassOptions"
|
|
||||||
clEnumVal(Structure , "print pass structure before run()"),
|
|
||||||
clEnumVal(Executions, "print pass name before it is executed"),
|
|
||||||
clEnumVal(Details , "print pass details when it is executed"),
|
|
||||||
0));
|
|
||||||
|
|
||||||
void PMDebug::PrintPassStructure(Pass *P) {
|
|
||||||
if (PassDebugging >= Structure)
|
|
||||||
P->dumpPassStructure();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
|
void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
|
||||||
Pass *P, Annotable *V) {
|
Pass *P, Annotable *V) {
|
||||||
|
@ -190,22 +152,12 @@ void PMDebug::PrintAnalysisSetInfo(unsigned Depth, const char *Msg,
|
||||||
Pass *P, const std::vector<AnalysisID> &Set){
|
Pass *P, const std::vector<AnalysisID> &Set){
|
||||||
if (PassDebugging >= Details && !Set.empty()) {
|
if (PassDebugging >= Details && !Set.empty()) {
|
||||||
std::cerr << (void*)P << std::string(Depth*2+3, ' ') << Msg << " Analyses:";
|
std::cerr << (void*)P << std::string(Depth*2+3, ' ') << Msg << " Analyses:";
|
||||||
for (unsigned i = 0; i != Set.size(); ++i) {
|
for (unsigned i = 0; i != Set.size(); ++i)
|
||||||
// FIXME: This can use the local pass map!
|
std::cerr << " " << Set[i]->getPassName();
|
||||||
Pass *P = Set[i]->createPass(); // Good thing this is just debug code...
|
|
||||||
std::cerr << " " << P->getPassName();
|
|
||||||
delete P;
|
|
||||||
}
|
|
||||||
std::cerr << "\n";
|
std::cerr << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// dumpPassStructure - Implement the -debug-passes=Structure option
|
|
||||||
void Pass::dumpPassStructure(unsigned Offset) {
|
|
||||||
std::cerr << std::string(Offset*2, ' ') << getPassName() << "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Pass Implementation
|
// Pass Implementation
|
||||||
//
|
//
|
||||||
|
@ -214,6 +166,10 @@ void Pass::addToPassManager(PassManagerT<Module> *PM, AnalysisUsage &AU) {
|
||||||
PM->addPass(this, AU);
|
PM->addPass(this, AU);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dumpPassStructure - Implement the -debug-passes=Structure option
|
||||||
|
void Pass::dumpPassStructure(unsigned Offset) {
|
||||||
|
std::cerr << std::string(Offset*2, ' ') << getPassName() << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
// getPassName - Use C++ RTTI to get a SOMEWHAT intelligable name for the pass.
|
// getPassName - Use C++ RTTI to get a SOMEWHAT intelligable name for the pass.
|
||||||
//
|
//
|
||||||
|
|
|
@ -16,10 +16,33 @@
|
||||||
#define LLVM_PASSMANAGER_T_H
|
#define LLVM_PASSMANAGER_T_H
|
||||||
|
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include <string>
|
#include "Support/CommandLine.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
class Annotable;
|
class Annotable;
|
||||||
|
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
// Pass debugging information. Often it is useful to find out what pass is
|
||||||
|
// running when a crash occurs in a utility. When this library is compiled with
|
||||||
|
// debugging on, a command line option (--debug-pass) is enabled that causes the
|
||||||
|
// pass name to be printed before it executes.
|
||||||
|
//
|
||||||
|
|
||||||
|
// Different debug levels that can be enabled...
|
||||||
|
enum PassDebugLevel {
|
||||||
|
None, Structure, Executions, Details
|
||||||
|
};
|
||||||
|
|
||||||
|
static cl::opt<enum PassDebugLevel>
|
||||||
|
PassDebugging("debug-pass", cl::Hidden,
|
||||||
|
cl::desc("Print PassManager debugging information"),
|
||||||
|
cl::values(
|
||||||
|
clEnumVal(None , "disable debug output"),
|
||||||
|
// TODO: add option to print out pass names "PassOptions"
|
||||||
|
clEnumVal(Structure , "print pass structure before run()"),
|
||||||
|
clEnumVal(Executions, "print pass name before it is executed"),
|
||||||
|
clEnumVal(Details , "print pass details when it is executed"),
|
||||||
|
0));
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// PMDebug class - a set of debugging functions, that are not to be
|
// PMDebug class - a set of debugging functions, that are not to be
|
||||||
// instantiated by the template.
|
// instantiated by the template.
|
||||||
|
@ -28,7 +51,10 @@ struct PMDebug {
|
||||||
// If compiled in debug mode, these functions can be enabled by setting
|
// If compiled in debug mode, these functions can be enabled by setting
|
||||||
// -debug-pass on the command line of the tool being used.
|
// -debug-pass on the command line of the tool being used.
|
||||||
//
|
//
|
||||||
static void PrintPassStructure(Pass *P);
|
static void PrintPassStructure(Pass *P) {
|
||||||
|
if (PassDebugging >= Structure)
|
||||||
|
P->dumpPassStructure();
|
||||||
|
}
|
||||||
static void PrintPassInformation(unsigned,const char*,Pass *, Annotable *);
|
static void PrintPassInformation(unsigned,const char*,Pass *, Annotable *);
|
||||||
static void PrintAnalysisSetInfo(unsigned,const char*,Pass *P,
|
static void PrintAnalysisSetInfo(unsigned,const char*,Pass *P,
|
||||||
const std::vector<AnalysisID> &);
|
const std::vector<AnalysisID> &);
|
||||||
|
|
Loading…
Reference in New Issue