Correctly extract the ValueType from a VTSDNode.
[oota-llvm.git] / lib / Analysis / ProfileInfo.cpp
index fa3af80044fa66f1cc4eebb13a00350267dbe018..c8dad662f19330f435d5f950cbaf7a56be40f89e 100644 (file)
@@ -16,6 +16,7 @@
 #include "llvm/Analysis/ProfileInfo.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CFG.h"
+#include "llvm/Support/Compiler.h"
 #include <set>
 using namespace llvm;
 
@@ -23,6 +24,7 @@ using namespace llvm;
 namespace {
   RegisterAnalysisGroup<ProfileInfo> Z("Profile Information");
 }
+char ProfileInfo::ID = 0;
 
 ProfileInfo::~ProfileInfo() {}
 
@@ -32,7 +34,7 @@ unsigned ProfileInfo::getExecutionCount(BasicBlock *BB) const {
   // Are there zero predecessors of this block?
   if (PI == PE) {
     // If this is the entry block, look for the Null -> Entry edge.
-    if (BB == &BB->getParent()->front())
+    if (BB == &BB->getParent()->getEntryBlock())
       return getEdgeWeight(0, BB);
     else
       return 0;   // Otherwise, this is a dead block.
@@ -82,14 +84,19 @@ unsigned ProfileInfo::getExecutionCount(BasicBlock *BB) const {
 //
 
 namespace {
-  struct NoProfileInfo : public ImmutablePass, public ProfileInfo {};
+  struct VISIBILITY_HIDDEN NoProfileInfo 
+    : public ImmutablePass, public ProfileInfo {
+    static char ID; // Class identification, replacement for typeinfo
+    NoProfileInfo() : ImmutablePass((intptr_t)&ID) {}
+  };
 
+  char NoProfileInfo::ID = 0;
   // Register this pass...
-  RegisterOpt<NoProfileInfo>
+  RegisterPass<NoProfileInfo>
   X("no-profile", "No Profile Information");
 
   // Declare that we implement the ProfileInfo interface
-  RegisterAnalysisGroup<ProfileInfo, NoProfileInfo, true> Y;
+  RegisterAnalysisGroup<ProfileInfo, true> Y(X);
 }  // End of anonymous namespace
 
 ImmutablePass *llvm::createNoProfileInfoPass() { return new NoProfileInfo(); }