Convert some tab stops into spaces.
[oota-llvm.git] / lib / Analysis / AliasAnalysisCounter.cpp
index 53715519fe98c2876c00bb1ad8b6efc3ec85bf90..1053955ea23397654a33b904b7a8742e1dc26087 100644 (file)
@@ -31,7 +31,6 @@ namespace {
   class AliasAnalysisCounter : public ModulePass, public AliasAnalysis {
     unsigned No, May, Must;
     unsigned NoMR, JustRef, JustMod, MR;
-    const char *Name;
     Module *M;
   public:
     static char ID; // Class identification, replacement for typeinfo
@@ -41,31 +40,31 @@ namespace {
     }
 
     void printLine(const char *Desc, unsigned Val, unsigned Sum) {
-      dbgs() <<  "  " << Val << " " << Desc << " responses ("
+      errs() <<  "  " << Val << " " << Desc << " responses ("
              << Val*100/Sum << "%)\n";
     }
     ~AliasAnalysisCounter() {
       unsigned AASum = No+May+Must;
       unsigned MRSum = NoMR+JustRef+JustMod+MR;
       if (AASum + MRSum) { // Print a report if any counted queries occurred...
-        dbgs() << "\n===== Alias Analysis Counter Report =====\n"
-               << "  Analysis counted: " << Name << "\n"
+        errs() << "\n===== Alias Analysis Counter Report =====\n"
+               << "  Analysis counted:\n"
                << "  " << AASum << " Total Alias Queries Performed\n";
         if (AASum) {
           printLine("no alias",     No, AASum);
           printLine("may alias",   May, AASum);
           printLine("must alias", Must, AASum);
-          dbgs() << "  Alias Analysis Counter Summary: " << No*100/AASum << "%/"
+          errs() << "  Alias Analysis Counter Summary: " << No*100/AASum << "%/"
                  << May*100/AASum << "%/" << Must*100/AASum<<"%\n\n";
         }
 
-        dbgs() << "  " << MRSum    << " Total Mod/Ref Queries Performed\n";
+        errs() << "  " << MRSum    << " Total Mod/Ref Queries Performed\n";
         if (MRSum) {
           printLine("no mod/ref",    NoMR, MRSum);
           printLine("ref",        JustRef, MRSum);
           printLine("mod",        JustMod, MRSum);
           printLine("mod/ref",         MR, MRSum);
-          dbgs() << "  Mod/Ref Analysis Counter Summary: " <<NoMR*100/MRSum
+          errs() << "  Mod/Ref Analysis Counter Summary: " <<NoMR*100/MRSum
                  << "%/" << JustRef*100/MRSum << "%/" << JustMod*100/MRSum
                  << "%/" << MR*100/MRSum <<"%\n\n";
         }
@@ -75,7 +74,6 @@ namespace {
     bool runOnModule(Module &M) {
       this->M = &M;
       InitializeAliasAnalysis(this);
-      Name = dynamic_cast<Pass*>(&getAnalysis<AliasAnalysis>())->getPassName();
       return false;
     }
 
@@ -85,6 +83,16 @@ namespace {
       AU.setPreservesAll();
     }
 
+    /// getAdjustedAnalysisPointer - This method is used when a pass implements
+    /// an analysis interface through multiple inheritance.  If needed, it
+    /// should override this to adjust the this pointer as needed for the
+    /// specified pass info.
+    virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) {
+      if (PI->isPassID(&AliasAnalysis::ID))
+        return (AliasAnalysis*)this;
+      return this;
+    }
+    
     // FIXME: We could count these too...
     bool pointsToConstantMemory(const Value *P) {
       return getAnalysis<AliasAnalysis>().pointsToConstantMemory(P);
@@ -125,13 +133,13 @@ AliasAnalysisCounter::alias(const Value *V1, unsigned V1Size,
   }
 
   if (PrintAll || (PrintAllFailures && R == MayAlias)) {
-    dbgs() << AliasString << ":\t";
-    dbgs() << "[" << V1Size << "B] ";
-    WriteAsOperand(dbgs(), V1, true, M);
-    dbgs() << ", ";
-    dbgs() << "[" << V2Size << "B] ";
-    WriteAsOperand(dbgs(), V2, true, M);
-    dbgs() << "\n";
+    errs() << AliasString << ":\t";
+    errs() << "[" << V1Size << "B] ";
+    WriteAsOperand(errs(), V1, true, M);
+    errs() << ", ";
+    errs() << "[" << V2Size << "B] ";
+    WriteAsOperand(errs(), V2, true, M);
+    errs() << "\n";
   }
 
   return R;
@@ -151,10 +159,10 @@ AliasAnalysisCounter::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
   }
 
   if (PrintAll || (PrintAllFailures && R == ModRef)) {
-    dbgs() << MRString << ":  Ptr: ";
-    dbgs() << "[" << Size << "B] ";
-    WriteAsOperand(dbgs(), P, true, M);
-    dbgs() << "\t<->" << *CS.getInstruction();
+    errs() << MRString << ":  Ptr: ";
+    errs() << "[" << Size << "B] ";
+    WriteAsOperand(errs(), P, true, M);
+    errs() << "\t<->" << *CS.getInstruction() << '\n';
   }
   return R;
 }