summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2010-10-13 05:54:10 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2010-10-13 05:54:10 +0000
commit4bcc0228dcc90385e90f22cef38b2614d3aa3cd1 (patch)
treea74f76ee3b8b4a38eff8d9aab3e937f6187e9af3
parent9649390e1fcb6d42e228364230f16409ad150fef (diff)
downloadexternal_llvm-4bcc0228dcc90385e90f22cef38b2614d3aa3cd1.zip
external_llvm-4bcc0228dcc90385e90f22cef38b2614d3aa3cd1.tar.gz
external_llvm-4bcc0228dcc90385e90f22cef38b2614d3aa3cd1.tar.bz2
RegionInfo: Allow to update exit and entry of a region.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116396 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/RegionInfo.h12
-rw-r--r--lib/Analysis/RegionInfo.cpp9
2 files changed, 21 insertions, 0 deletions
diff --git a/include/llvm/Analysis/RegionInfo.h b/include/llvm/Analysis/RegionInfo.h
index 0d3ce11..1626abb 100644
--- a/include/llvm/Analysis/RegionInfo.h
+++ b/include/llvm/Analysis/RegionInfo.h
@@ -257,6 +257,18 @@ public:
/// @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.
diff --git a/lib/Analysis/RegionInfo.cpp b/lib/Analysis/RegionInfo.cpp
index 75ca61f..0bf6aad 100644
--- a/lib/Analysis/RegionInfo.cpp
+++ b/lib/Analysis/RegionInfo.cpp
@@ -72,6 +72,15 @@ Region::~Region() {
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);