[llvm-commits] [llvm] r116396 - in /llvm/trunk: include/llvm/Analysis/RegionInfo.h lib/Analysis/RegionInfo.cpp

Tobias Grosser grosser at fim.uni-passau.de
Tue Oct 12 22:54:10 PDT 2010


Author: grosser
Date: Wed Oct 13 00:54:10 2010
New Revision: 116396

URL: http://llvm.org/viewvc/llvm-project?rev=116396&view=rev
Log:
RegionInfo: Allow to update exit and entry of a region.

Modified:
    llvm/trunk/include/llvm/Analysis/RegionInfo.h
    llvm/trunk/lib/Analysis/RegionInfo.cpp

Modified: llvm/trunk/include/llvm/Analysis/RegionInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/RegionInfo.h?rev=116396&r1=116395&r2=116396&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/RegionInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/RegionInfo.h Wed Oct 13 00:54:10 2010
@@ -257,6 +257,18 @@
   /// @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.

Modified: llvm/trunk/lib/Analysis/RegionInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/RegionInfo.cpp?rev=116396&r1=116395&r2=116396&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/RegionInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/RegionInfo.cpp Wed Oct 13 00:54:10 2010
@@ -72,6 +72,15 @@
     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);
 





More information about the llvm-commits mailing list