Register scavenger is now capable of scavenging. It spills a register whose use of...
[oota-llvm.git] / include / llvm / CodeGen / MachineBasicBlock.h
index 1fd36ed55a71fbe478f7b04f9181f5c777bf0e10..d076046407f28613c0d562b38218fc1546b8fb0d 100644 (file)
@@ -58,19 +58,30 @@ public:
 class BasicBlock;
 
 class MachineBasicBlock {
-public:
   typedef ilist<MachineInstr> Instructions;
   Instructions Insts;
   MachineBasicBlock *Prev, *Next;
   const BasicBlock *BB;
-  std::vector<MachineBasicBlock *> Predecessors;
-  std::vector<MachineBasicBlock *> Successors;
   int Number;
   MachineFunction *Parent;
 
+  /// Predecessors/Successors - Keep track of the predecessor / successor
+  /// basicblocks.
+  std::vector<MachineBasicBlock *> Predecessors;
+  std::vector<MachineBasicBlock *> Successors;
+
+  /// LiveIns - Keep track of the physical registers that are livein of
+  /// the basicblock.
+  std::vector<unsigned> LiveIns;
+  
+  /// IsLandingPad - Indicate that this basic block is entered via an
+  /// exception handler.
+  bool IsLandingPad;
+
 public:
   MachineBasicBlock(const BasicBlock *bb = 0) : Prev(0), Next(0), BB(bb),
-                                                Number(-1), Parent(0) {
+                                                Number(-1), Parent(0),
+                                                IsLandingPad(false) {
     Insts.parent = this;
   }
 
@@ -125,6 +136,34 @@ public:
   unsigned             succ_size()  const { return Successors.size();    }
   bool                 succ_empty() const { return Successors.empty();   }
 
+  // LiveIn management methods.
+
+  /// addLiveIn - Add the specified register as a live in.  Note that it
+  /// is an error to add the same register to the same set more than once.
+  void addLiveIn(unsigned Reg)  { LiveIns.push_back(Reg); }
+
+  /// removeLiveIn - Remove the specified register from the live in set.
+  ///
+  void removeLiveIn(unsigned Reg);
+
+  // Iteration support for live in sets.  These sets are kept in sorted
+  // order by their register number.
+  typedef std::vector<unsigned>::iterator       livein_iterator;
+  typedef std::vector<unsigned>::const_iterator const_livein_iterator;
+  livein_iterator       livein_begin()       { return LiveIns.begin(); }
+  const_livein_iterator livein_begin() const { return LiveIns.begin(); }
+  livein_iterator       livein_end()         { return LiveIns.end(); }
+  const_livein_iterator livein_end()   const { return LiveIns.end(); }
+  bool            livein_empty() const { return LiveIns.empty(); }
+
+  /// isLandingPad - Returns true if the block is a landing pad. That is
+  /// this basic block is entered via an exception handler.
+  bool isLandingPad() const { return IsLandingPad; }
+
+  /// setIsLandingPad - Indicates the block is a landing pad.  That is
+  /// this basic block is entered via an exception handler.
+  void setIsLandingPad() { IsLandingPad = true; }
+
   // Code Layout methods.
   
   /// moveBefore/moveAfter - move 'this' block before or after the specified