mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-30 19:35:54 +00:00
Use a module analysis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3133 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0b0554596e
commit
1ad4436cc2
@ -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…
x
Reference in New Issue
Block a user