Factor the calculation details for PostDomTree out of PostDominators.cpp and
[oota-llvm.git] / include / llvm / Analysis / IntervalPartition.h
index 197c469db984885ae1d135d1d01a4cd5af1da6bc..1f985e37d6456d5dc299f6ec40dc0efa5a5e19e1 100644 (file)
@@ -1,4 +1,11 @@
-//===- IntervalPartition.h - Interval partition Calculation ------*- C++ -*--=//
+//===- IntervalPartition.h - Interval partition Calculation -----*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
 //
 // This file contains the declaration of the IntervalPartition class, which
 // calculates and represents the interval partition of a function, or a
@@ -19,6 +26,8 @@
 #include "llvm/Analysis/Interval.h"
 #include "llvm/Pass.h"
 
+namespace llvm {
+
 //===----------------------------------------------------------------------===//
 //
 // IntervalPartition - This class builds and holds an "interval partition" for
@@ -36,9 +45,9 @@ class IntervalPartition : public FunctionPass {
   std::vector<Interval*> Intervals;
 
 public:
-  static AnalysisID ID;    // We are an analysis, we must have an ID
+  static char ID; // Pass identification, replacement for typeid
 
-  IntervalPartition() : RootInterval(0) {}
+  IntervalPartition() : FunctionPass((intptr_t)&ID), RootInterval(0) {}
 
   // run - Calculate the interval partition for this function
   virtual bool runOnFunction(Function &F);
@@ -53,7 +62,10 @@ public:
   ~IntervalPartition() { destroy(); }
 
   // print - Show contents in human readable format...
-  virtual void print(std::ostream &O) const;
+  virtual void print(std::ostream &O, const Module* = 0) const;
+  void print(std::ostream *O, const Module* M = 0) const {
+    if (O) print(*O, M);
+  }
 
   // getRootInterval() - Return the root interval that contains the starting
   // block of the function.
@@ -91,10 +103,12 @@ private:
 
   // updatePredecessors - Interval generation only sets the successor fields of
   // the interval data structures.  After interval generation is complete,
-  // run through all of the intervals and propogate successor info as
+  // run through all of the intervals and propagate successor info as
   // predecessor info.
   //
   void updatePredecessors(Interval *Int);
 };
 
+} // End llvm namespace
+
 #endif