Add a const.
[oota-llvm.git] / lib / Analysis / ProfileVerifierPass.cpp
index 36a80baf539d21110c145dd040a68edd010f4e41..3f01b2d592bc4205604d1d6402f3c66df5d2d6b3 100644 (file)
@@ -59,10 +59,10 @@ namespace llvm {
   public:
     static char ID; // Class identification, replacement for typeinfo
 
-    explicit ProfileVerifierPassT () : FunctionPass(&ID) {
+    explicit ProfileVerifierPassT () : FunctionPass(ID) {
       DisableAssertions = ProfileVerifierDisableAssertions;
     }
-    explicit ProfileVerifierPassT (bool da) : FunctionPass(&ID), 
+    explicit ProfileVerifierPassT (bool da) : FunctionPass(ID), 
                                               DisableAssertions(da) {
     }
 
@@ -96,13 +96,13 @@ namespace llvm {
     double inWeight = 0;
     int inCount = 0;
     std::set<const BType*> ProcessedPreds;
-    for ( pred_const_iterator bbi = pred_begin(BB), bbe = pred_end(BB);
-          bbi != bbe; ++bbi ) {
+    for (const_pred_iterator bbi = pred_begin(BB), bbe = pred_end(BB);
+         bbi != bbe; ++bbi ) {
       if (ProcessedPreds.insert(*bbi).second) {
         typename ProfileInfoT<FType, BType>::Edge E = PI->getEdge(*bbi,BB);
         double EdgeWeight = PI->getEdgeWeight(E);
         if (EdgeWeight == ProfileInfoT<FType, BType>::MissingValue) { EdgeWeight = 0; }
-        errs() << "calculated in-edge " << E << ": " 
+        dbgs() << "calculated in-edge " << E << ": " 
                << format("%20.20g",EdgeWeight) << "\n";
         inWeight += EdgeWeight;
         inCount++;
@@ -117,13 +117,13 @@ namespace llvm {
         typename ProfileInfoT<FType, BType>::Edge E = PI->getEdge(BB,*bbi);
         double EdgeWeight = PI->getEdgeWeight(E);
         if (EdgeWeight == ProfileInfoT<FType, BType>::MissingValue) { EdgeWeight = 0; }
-        errs() << "calculated out-edge " << E << ": " 
+        dbgs() << "calculated out-edge " << E << ": " 
                << format("%20.20g",EdgeWeight) << "\n";
         outWeight += EdgeWeight;
         outCount++;
       }
     }
-    errs() << "Block " << BB->getNameStr()                << " in " 
+    dbgs() << "Block " << BB->getNameStr()                << " in " 
            << BB->getParent()->getNameStr()               << ":"
            << "BBWeight="  << format("%20.20g",BBWeight)  << ","
            << "inWeight="  << format("%20.20g",inWeight)  << ","
@@ -141,7 +141,7 @@ namespace llvm {
 
   template<class FType, class BType>
   void ProfileVerifierPassT<FType, BType>::debugEntry (DetailedBlockInfo *DI) {
-    errs() << "TROUBLE: Block " << DI->BB->getNameStr()       << " in "
+    dbgs() << "TROUBLE: Block " << DI->BB->getNameStr()       << " in "
            << DI->BB->getParent()->getNameStr()               << ":"
            << "BBWeight="  << format("%20.20g",DI->BBWeight)  << ","
            << "inWeight="  << format("%20.20g",DI->inWeight)  << ","
@@ -191,20 +191,20 @@ namespace llvm {
   }
 
   #define ASSERTMESSAGE(M) \
-    { errs() << "ASSERT:" << (M) << "\n"; \
+    { dbgs() << "ASSERT:" << (M) << "\n"; \
       if (!DisableAssertions) assert(0 && (M)); }
 
   template<class FType, class BType>
   double ProfileVerifierPassT<FType, BType>::ReadOrAssert(typename ProfileInfoT<FType, BType>::Edge E) {
     double EdgeWeight = PI->getEdgeWeight(E);
     if (EdgeWeight == ProfileInfoT<FType, BType>::MissingValue) {
-      errs() << "Edge " << E << " in Function " 
+      dbgs() << "Edge " << E << " in Function " 
              << ProfileInfoT<FType, BType>::getFunction(E)->getNameStr() << ": ";
       ASSERTMESSAGE("Edge has missing value");
       return 0;
     } else {
       if (EdgeWeight < 0) {
-        errs() << "Edge " << E << " in Function " 
+        dbgs() << "Edge " << E << " in Function " 
                << ProfileInfoT<FType, BType>::getFunction(E)->getNameStr() << ": ";
         ASSERTMESSAGE("Edge has negative value");
       }
@@ -218,7 +218,7 @@ namespace llvm {
                                                       DetailedBlockInfo *DI) {
     if (Error) {
       DEBUG(debugEntry(DI));
-      errs() << "Block " << DI->BB->getNameStr() << " in Function " 
+      dbgs() << "Block " << DI->BB->getNameStr() << " in Function " 
              << DI->BB->getParent()->getNameStr() << ": ";
       ASSERTMESSAGE(Message);
     }
@@ -242,7 +242,7 @@ namespace llvm {
 
     // Read predecessors.
     std::set<const BType*> ProcessedPreds;
-    pred_const_iterator bpi = pred_begin(BB), bpe = pred_end(BB);
+    const_pred_iterator bpi = pred_begin(BB), bpe = pred_end(BB);
     // If there are none, check for (0,BB) edge.
     if (bpi == bpe) {
       DI.inWeight += ReadOrAssert(PI->getEdge(0,BB));
@@ -366,8 +366,8 @@ namespace llvm {
   char ProfileVerifierPassT<FType, BType>::ID = 0;
 }
 
-static RegisterPass<ProfileVerifierPass>
-X("profile-verifier", "Verify profiling information", false, true);
+INITIALIZE_PASS(ProfileVerifierPass, "profile-verifier",
+                "Verify profiling information", false, true);
 
 namespace llvm {
   FunctionPass *createProfileVerifierPass() {