Convert this code from using annotations to using a local map
[oota-llvm.git] / lib / Analysis / LiveVar / BBLiveVar.h
index 88e99a804eb3d22b959ab92c503e2a1d6a8a6a2d..638b5aa8c614cb9d9618de72b3c54f70c8391a1b 100644 (file)
@@ -9,8 +9,7 @@
 #define LIVE_VAR_BB_H
 
 #include "llvm/CodeGen/ValueSet.h"
-#include "Support/Annotation.h"
-#include <map>
+#include "Support/hash_map"
 class BasicBlock;
 class Value;
 class MachineBasicBlock;
@@ -24,7 +23,7 @@ enum LiveVarDebugLevel_t {
 
 extern LiveVarDebugLevel_t DEBUG_LV;
 
-class BBLiveVar : public Annotation {
+class BBLiveVar {
   const BasicBlock &BB;         // pointer to BasicBlock
   MachineBasicBlock &MBB;       // Pointer to MachineBasicBlock
   unsigned POID;                // Post-Order ID
@@ -36,7 +35,7 @@ class BBLiveVar : public Annotation {
                                 // map that contains PredBB -> Phi arguments
                                 // coming in on that edge.  such uses have to be
                                 // treated differently from ordinary uses.
-  std::map<const BasicBlock *, ValueSet> PredToEdgeInSetMap;
+  hash_map<const BasicBlock *, ValueSet> PredToEdgeInSetMap;
   
   // method to propagate an InSet to OutSet of a predecessor
   bool setPropagate(ValueSet *OutSetOfPred, 
@@ -50,14 +49,9 @@ class BBLiveVar : public Annotation {
   void addUse(const Value *Op);
 
   void calcDefUseSets();         // calculates the Def & Use sets for this BB
+public:
 
   BBLiveVar(const BasicBlock &BB, MachineBasicBlock &MBB, unsigned POID);
-  ~BBLiveVar() {}                // make dtor private
- public:
-  static BBLiveVar *CreateOnBB(const BasicBlock &BB, MachineBasicBlock &MBB,
-                               unsigned POID);
-  static BBLiveVar *GetFromBB(const BasicBlock &BB);
-  static void RemoveFromBB(const BasicBlock &BB);
 
   inline bool isInSetChanged() const  { return InSetChanged; }    
   inline bool isOutSetChanged() const { return OutSetChanged; }
@@ -69,7 +63,7 @@ class BBLiveVar : public Annotation {
   bool applyTransferFunc();      // calcultes the In in terms of Out 
 
   // calculates Out set using In sets of the predecessors
-  bool applyFlowFunc();
+  bool applyFlowFunc(hash_map<const BasicBlock*, BBLiveVar*> &BBLiveVarInfo);
 
   inline const ValueSet &getOutSet() const { return OutSet; }
   inline       ValueSet &getOutSet()       { return OutSet; }