diff --git a/lib/Analysis/AliasAnalysisCounter.cpp b/lib/Analysis/AliasAnalysisCounter.cpp index d80a3f8bf94..ba41092128b 100644 --- a/lib/Analysis/AliasAnalysisCounter.cpp +++ b/lib/Analysis/AliasAnalysisCounter.cpp @@ -10,10 +10,31 @@ #include namespace { - unsigned No = 0, May = 0, Must = 0; + class AliasAnalysisCounter : public Pass, public AliasAnalysis { + unsigned No, May, Must; + const char *Name; + public: + AliasAnalysisCounter() : No(0), May(0), Must(0) {} + ~AliasAnalysisCounter() { + unsigned Sum = No+May+Must; + if (Sum) { // Print a report if any counted queries occurred... + std::cerr + << "\n===== Alias Analysis Counter Report =====\n" + << " Analysis counted: " << Name << "\n" + << " " << Sum << " Total Alias Queries Performed\n" + << " " << No << " no alias responses (" << No*100/Sum << "%)\n" + << " " << May << " may alias responses (" << May*100/Sum << "%)\n" + << " " << Must << " must alias responses (" <(&getAnalysis())->getPassName(); + return false; + } - struct AliasAnalysisCounter : public Pass, public AliasAnalysis { - bool run(Module &M) { return false; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); AU.setPreservesAll(); @@ -44,21 +65,4 @@ namespace { RegisterOpt X("count-aa", "Count Alias Analysis Query Responses"); RegisterAnalysisGroup Y; - - - struct ResultPrinter { - ~ResultPrinter() { - unsigned Sum = No+May+Must; - if (Sum) { // Print a report if any counted queries occurred... - std::cerr - << "\n===== Alias Analysis Counter Report =====\n" - << " " << Sum << " Total Alias Queries Performed\n" - << " " << No << " no alias responses (" << No*100/Sum << "%)\n" - << " " << May << " may alias responses (" << May*100/Sum << "%)\n" - << " " << Must << " must alias responses (" <