Split out altivec notes into their own README
[oota-llvm.git] / lib / Target / SparcV9 / LiveVar / BBLiveVar.h
index eada3a7f08651f0e2bce1a0e323ec9cc55499dfb..f33a6768b520435d057291e14c8cdedf4b330c1c 100644 (file)
@@ -1,4 +1,11 @@
-//===-- BBLiveVar.h - Live Variable Analysis for a BasicBlock ----*- C++ -*--=//
+//===-- BBLiveVar.h - Live Variable Analysis for a BasicBlock ---*- 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 is a BasicBlock annotation class that is used by live var analysis to
 // hold data flow information for a basic block.
@@ -8,9 +15,11 @@
 #ifndef LIVE_VAR_BB_H
 #define LIVE_VAR_BB_H
 
-#include "llvm/Analysis/LiveVar/ValueSet.h"
-#include "llvm/Annotation.h"
-#include <map>
+#include "llvm/CodeGen/ValueSet.h"
+#include "llvm/ADT/hash_map"
+
+namespace llvm {
+
 class BasicBlock;
 class Value;
 class MachineBasicBlock;
@@ -24,9 +33,9 @@ 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
+  const MachineBasicBlock &MBB; // Pointer to MachineBasicBlock
   unsigned POID;                // Post-Order ID
 
   ValueSet DefSet;           // Def set (with no preceding uses) for LV analysis
@@ -36,46 +45,46 @@ 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;
-  
-  // method to propogate an InSet to OutSet of a predecessor
-  bool setPropagate(ValueSet *OutSetOfPred, 
+  hash_map<const BasicBlock *, ValueSet> PredToEdgeInSetMap;
+
+  // method to propagate an InSet to OutSet of a predecessor
+  bool setPropagate(ValueSet *OutSetOfPred,
                     const ValueSet *InSetOfThisBB,
                     const BasicBlock *PredBB);
 
   // To add an operand which is a def
-  void addDef(const Value *Op); 
+  void addDef(const Value *Op);
 
   // To add an operand which is a use
   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);
+  BBLiveVar(const BasicBlock &BB, const MachineBasicBlock &MBB, unsigned POID);
 
-  inline bool isInSetChanged() const  { return InSetChanged; }    
+  inline bool isInSetChanged() const  { return InSetChanged; }
   inline bool isOutSetChanged() const { return OutSetChanged; }
 
-  MachineBasicBlock &getMachineBasicBlock() const { return MBB; }
+  const MachineBasicBlock &getMachineBasicBlock() const { return MBB; }
 
   inline unsigned getPOId() const { return POID; }
 
-  bool applyTransferFunc();      // calcultes the In in terms of Out 
+  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; }
+
   inline const ValueSet  &getInSet() const { return InSet; }
+  inline       ValueSet  &getInSet()       { return InSet; }
 
   void printAllSets() const;      // for printing Def/In/Out sets
   void printInOutSets() const;    // for printing In/Out sets
 };
 
+} // End llvm namespace
+
 #endif