forked from OSchip/llvm-project
parent
fdf6bc216f
commit
2511b6e296
|
@ -19,17 +19,22 @@
|
|||
|
||||
|
||||
struct ModulePassPrinter : public Pass {
|
||||
Pass *PassToPrint;
|
||||
ModulePassPrinter(Pass *PI) : PassToPrint(PI) {}
|
||||
const PassInfo *PassToPrint;
|
||||
ModulePassPrinter(const PassInfo *PI) : PassToPrint(PI) {}
|
||||
|
||||
virtual bool run(Module &M) {
|
||||
std::cout << "Printing Analysis info for Pass "
|
||||
<< PassToPrint->getPassName() << ":\n";
|
||||
PassToPrint->print(std::cout, &M);
|
||||
getAnalysis<Pass>(PassToPrint).print(std::cout, &M);
|
||||
|
||||
// Get and print pass...
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired(PassToPrint);
|
||||
AU.setPreservesAll();
|
||||
}
|
||||
};
|
||||
|
||||
struct FunctionPassPrinter : public FunctionPass {
|
||||
|
@ -122,7 +127,7 @@ int main(int argc, char **argv) {
|
|||
else if (FunctionPass *FP = dynamic_cast<FunctionPass*>(P))
|
||||
Passes.add(new FunctionPassPrinter(Analysis));
|
||||
else
|
||||
Passes.add(new ModulePassPrinter(P));
|
||||
Passes.add(new ModulePassPrinter(Analysis));
|
||||
|
||||
} else
|
||||
cerr << "Cannot create pass: " << Analysis->getPassName() << "\n";
|
||||
|
|
Loading…
Reference in New Issue