RegionInfo: Allow to update exit and entry of a region.
authorTobias Grosser <grosser@fim.uni-passau.de>
Wed, 13 Oct 2010 05:54:10 +0000 (05:54 +0000)
committerTobias Grosser <grosser@fim.uni-passau.de>
Wed, 13 Oct 2010 05:54:10 +0000 (05:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116396 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/RegionInfo.h
lib/Analysis/RegionInfo.cpp

index 0d3ce11593279b6ec26670744e683769bc2d204f..1626abb36a035d2a6ebf6ec43b0a5693eb660da1 100644 (file)
@@ -257,6 +257,18 @@ public:
   /// @return The entry BasicBlock of the region.
   BasicBlock *getEntry() const { return RegionNode::getEntry(); }
 
   /// @return The entry BasicBlock of the region.
   BasicBlock *getEntry() const { return RegionNode::getEntry(); }
 
+  /// @brief Replace the entry basic block of the region with the new basic
+  ///        block.
+  ///
+  /// @param BB  The new entry basic block of the region.
+  void replaceEntry(BasicBlock *BB);
+
+  /// @brief Replace the exit basic block of the region with the new basic
+  ///        block.
+  ///
+  /// @param BB  The new exit basic block of the region.
+  void replaceExit(BasicBlock *BB);
+
   /// @brief Get the exit BasicBlock of the Region.
   /// @return The exit BasicBlock of the Region, NULL if this is the TopLevel
   ///         Region.
   /// @brief Get the exit BasicBlock of the Region.
   /// @return The exit BasicBlock of the Region, NULL if this is the TopLevel
   ///         Region.
index 75ca61f67c7346736acc96b1d272f59d231fb807..0bf6aad48a8d4f3c416eb6b8f0e2f5eef770a4cc 100644 (file)
@@ -72,6 +72,15 @@ Region::~Region() {
     delete *I;
 }
 
     delete *I;
 }
 
+void Region::replaceEntry(BasicBlock *BB) {
+  entry.setPointer(BB);
+}
+
+void Region::replaceExit(BasicBlock *BB) {
+  assert(exit && "No exit to replace!");
+  exit = BB;
+}
+
 bool Region::contains(const BasicBlock *B) const {
   BasicBlock *BB = const_cast<BasicBlock*>(B);
 
 bool Region::contains(const BasicBlock *B) const {
   BasicBlock *BB = const_cast<BasicBlock*>(B);