aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-10-16 20:41:42 +0000
committerChris Lattner <sabre@nondot.org>2006-10-16 20:41:42 +0000
commita7fa1476b6d8dd5e5b546aa5b700a85c650d6904 (patch)
tree5547fc4ed0c3b45b9d73291041f3f31fecf40292
parentba8a2ee548ba8d589fd22cf61d479bc5f1274c69 (diff)
add a ReplaceMBBInJumpTables method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30983 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/CodeGen/MachineJumpTableInfo.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineJumpTableInfo.h b/include/llvm/CodeGen/MachineJumpTableInfo.h
index c0f4af34c2..7f6c965d7c 100644
--- a/include/llvm/CodeGen/MachineJumpTableInfo.h
+++ b/include/llvm/CodeGen/MachineJumpTableInfo.h
@@ -26,6 +26,7 @@
namespace llvm {
class MachineBasicBlock;
+class TargetData;
/// MachineJumpTableEntry - One jump table in the jump table info.
///
@@ -54,6 +55,17 @@ public:
return JumpTables;
}
+ /// ReplaceMBBInJumpTables - If Old is the target of any jump tables, update
+ /// the jump tables to branch to New instead.
+ void ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New) {
+ for (unsigned i = 0, e = JumpTables.size(); i != e; ++i) {
+ MachineJumpTableEntry &JTE = JumpTables[i];
+ for (unsigned j = 0, e = JTE.MBBs.size(); j != e; ++j)
+ if (JTE.MBBs[j] == Old)
+ JTE.MBBs[j] = New;
+ }
+ }
+
/// getEntrySize - returns the size of an individual field in a jump table
unsigned getEntrySize() const;