Don't insert nearly as many redundant phi nodes.
[oota-llvm.git] / lib / Transforms / Scalar / BasicBlockPlacement.cpp
index c926c561d8216891f54a3c9e76e7ae469ca95e51..7521ea348740974b88efbfc25e0d9fe418c2dd53 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
+#define DEBUG_TYPE "block-placement"
 #include "llvm/Analysis/ProfileInfo.h"
 #include "llvm/Function.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CFG.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Transforms/Scalar.h"
 #include <set>
 using namespace llvm;
 
+STATISTIC(NumMoved, "Number of basic blocks moved");
+
 namespace {
-  Statistic<> NumMoved("block-placement", "Number of basic blocks moved");
+  struct VISIBILITY_HIDDEN BlockPlacement : public FunctionPass {
+    static char ID; // Pass identification, replacement for typeid
+    BlockPlacement() : FunctionPass((intptr_t)&ID) {}
 
-  struct BlockPlacement : public FunctionPass {
     virtual bool runOnFunction(Function &F);
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -68,8 +73,9 @@ namespace {
     void PlaceBlocks(BasicBlock *BB);
   };
 
-  RegisterOpt<BlockPlacement> X("block-placement",
-                                "Profile Guided Basic Block Placement");
+  char BlockPlacement::ID = 0;
+  RegisterPass<BlockPlacement> X("block-placement",
+                                 "Profile Guided Basic Block Placement");
 }
 
 FunctionPass *llvm::createBlockPlacementPass() { return new BlockPlacement(); }