mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-24 18:38:50 +00:00
Implement new -debug-pass=Arguments option that causes PassManager to
print out the command line options for the optimizations it is running. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3165 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
55b45bfae3
commit
48c1bc7b3a
@ -126,6 +126,19 @@ TimingInfo::~TimingInfo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PMDebug::PrintArgumentInformation(const Pass *P) {
|
||||||
|
// Print out passes in pass manager...
|
||||||
|
if (const AnalysisResolver *PM = dynamic_cast<const AnalysisResolver*>(P)) {
|
||||||
|
for (unsigned i = 0, e = PM->getNumContainedPasses(); i != e; ++i)
|
||||||
|
PrintArgumentInformation(PM->getContainedPass(i));
|
||||||
|
|
||||||
|
} else { // Normal pass. Print argument information...
|
||||||
|
// Print out arguments for registered passes that are _optimizations_
|
||||||
|
if (const PassInfo *PI = P->getPassInfo())
|
||||||
|
if (PI->getPassType() & PassInfo::Optimization)
|
||||||
|
std::cerr << " -" << PI->getPassArgument();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
|
void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
|
||||||
Pass *P, Annotable *V) {
|
Pass *P, Annotable *V) {
|
||||||
|
@ -29,7 +29,7 @@ class Annotable;
|
|||||||
|
|
||||||
// Different debug levels that can be enabled...
|
// Different debug levels that can be enabled...
|
||||||
enum PassDebugLevel {
|
enum PassDebugLevel {
|
||||||
None, Structure, Executions, Details
|
None, Arguments, Structure, Executions, Details
|
||||||
};
|
};
|
||||||
|
|
||||||
static cl::opt<enum PassDebugLevel>
|
static cl::opt<enum PassDebugLevel>
|
||||||
@ -37,7 +37,7 @@ PassDebugging("debug-pass", cl::Hidden,
|
|||||||
cl::desc("Print PassManager debugging information"),
|
cl::desc("Print PassManager debugging information"),
|
||||||
cl::values(
|
cl::values(
|
||||||
clEnumVal(None , "disable debug output"),
|
clEnumVal(None , "disable debug output"),
|
||||||
// TODO: add option to print out pass names "PassOptions"
|
clEnumVal(Arguments , "print pass arguments to pass to 'opt'"),
|
||||||
clEnumVal(Structure , "print pass structure before run()"),
|
clEnumVal(Structure , "print pass structure before run()"),
|
||||||
clEnumVal(Executions, "print pass name before it is executed"),
|
clEnumVal(Executions, "print pass name before it is executed"),
|
||||||
clEnumVal(Details , "print pass details when it is executed"),
|
clEnumVal(Details , "print pass details when it is executed"),
|
||||||
@ -48,13 +48,20 @@ PassDebugging("debug-pass", cl::Hidden,
|
|||||||
// instantiated by the template.
|
// instantiated by the template.
|
||||||
//
|
//
|
||||||
struct PMDebug {
|
struct PMDebug {
|
||||||
// If compiled in debug mode, these functions can be enabled by setting
|
static void PerformPassStartupStuff(Pass *P) {
|
||||||
// -debug-pass on the command line of the tool being used.
|
// If debugging is enabled, print out argument information...
|
||||||
//
|
if (PassDebugging >= Arguments) {
|
||||||
static void PrintPassStructure(Pass *P) {
|
std::cerr << "Pass Arguments: ";
|
||||||
if (PassDebugging >= Structure)
|
PrintArgumentInformation(P);
|
||||||
P->dumpPassStructure();
|
std::cerr << "\n";
|
||||||
|
|
||||||
|
// Print the pass execution structure
|
||||||
|
if (PassDebugging >= Structure)
|
||||||
|
P->dumpPassStructure();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void PrintArgumentInformation(const Pass *P);
|
||||||
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> &);
|
||||||
@ -151,7 +158,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Output debug information...
|
// Output debug information...
|
||||||
if (Parent == 0) PMDebug::PrintPassStructure(this);
|
if (Parent == 0) PMDebug::PerformPassStartupStuff(this);
|
||||||
|
|
||||||
// Run all of the passes
|
// Run all of the passes
|
||||||
for (unsigned i = 0, e = Passes.size(); i < e; ++i) {
|
for (unsigned i = 0, e = Passes.size(); i < e; ++i) {
|
||||||
@ -306,6 +313,12 @@ public:
|
|||||||
return 1 + Parent->getDepth();
|
return 1 + Parent->getDepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual unsigned getNumContainedPasses() const { return Passes.size(); }
|
||||||
|
virtual const Pass *getContainedPass(unsigned N) const {
|
||||||
|
assert(N < Passes.size() && "Pass number out of range!");
|
||||||
|
return Passes[N];
|
||||||
|
}
|
||||||
|
|
||||||
// add - Add a pass to the queue of passes to run. This passes ownership of
|
// add - Add a pass to the queue of passes to run. This passes ownership of
|
||||||
// the Pass to the PassManager. When the PassManager is destroyed, the pass
|
// the Pass to the PassManager. When the PassManager is destroyed, the pass
|
||||||
// will be destroyed as well, so there is no need to delete the pass. This
|
// will be destroyed as well, so there is no need to delete the pass. This
|
||||||
|
Loading…
x
Reference in New Issue
Block a user