Replaced uses of deprecated `MachineFunction::get(BasicBlock *BB)'.
[oota-llvm.git] / lib / Target / SparcV9 / LiveVar / BBLiveVar.h
index db5ac8f8d8f4d646871aa601e9f16fd30314c385..eada3a7f08651f0e2bce1a0e323ec9cc55499dfb 100644 (file)
 #include "llvm/Analysis/LiveVar/ValueSet.h"
 #include "llvm/Annotation.h"
 #include <map>
-class Method;
 class BasicBlock;
 class Value;
+class MachineBasicBlock;
+
+enum LiveVarDebugLevel_t {
+  LV_DEBUG_None,
+  LV_DEBUG_Normal,
+  LV_DEBUG_Instr,
+  LV_DEBUG_Verbose
+};
+
+extern LiveVarDebugLevel_t DEBUG_LV;
 
 class BBLiveVar : public Annotation {
-  const BasicBlock *BB;         // pointer to BasicBlock
+  const BasicBlock &BB;         // pointer to BasicBlock
+  MachineBasicBlock &MBB;       // Pointer to MachineBasicBlock
   unsigned POID;                // Post-Order ID
 
-  ValueSet DefSet;              // Def set for LV analysis
+  ValueSet DefSet;           // Def set (with no preceding uses) for LV analysis
   ValueSet InSet, OutSet;       // In & Out for LV analysis
   bool InSetChanged, OutSetChanged;   // set if the InSet/OutSet is modified
 
-                                // map that contains phi args->BB they came
-                                // set by calcDefUseSets & used by setPropagate
-  std::map<const Value *, const BasicBlock *> PhiArgMap;  
-
+                                // 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;
+  
   // method to propogate an InSet to OutSet of a predecessor
   bool setPropagate(ValueSet *OutSetOfPred, 
                     const ValueSet *InSetOfThisBB,
@@ -40,16 +51,19 @@ class BBLiveVar : public Annotation {
 
   void calcDefUseSets();         // calculates the Def & Use sets for this BB
 
-  BBLiveVar(const BasicBlock *BB, unsigned POID);
+  BBLiveVar(const BasicBlock &BB, MachineBasicBlock &MBB, unsigned POID);
   ~BBLiveVar() {}                // make dtor private
  public:
-  static BBLiveVar *CreateOnBB(const BasicBlock *BB, unsigned POID);
-  static BBLiveVar *GetFromBB(const BasicBlock *BB);
-  static void RemoveFromBB(const BasicBlock *BB);
+  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; }
 
+  MachineBasicBlock &getMachineBasicBlock() const { return MBB; }
+
   inline unsigned getPOId() const { return POID; }
 
   bool applyTransferFunc();      // calcultes the In in terms of Out