diff options
author | Dan Gohman <gohman@apple.com> | 2009-04-15 01:18:49 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-04-15 01:18:49 +0000 |
commit | 505065cdd0d951ce2d77c78f4435b002b70bd1bd (patch) | |
tree | 2561e5ea9e124159ca2c4df68e4408d5e160329c /llvm/lib/CodeGen/MachineFunction.cpp | |
parent | 89892b05c775e632c387d3ed7354980979274b39 (diff) | |
download | bcm5719-llvm-505065cdd0d951ce2d77c78f4435b002b70bd1bd.tar.gz bcm5719-llvm-505065cdd0d951ce2d77c78f4435b002b70bd1bd.zip |
Move MachineJumpTableInfo::ReplaceMBBInJumpTables out of line.
llvm-svn: 69125
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineFunction.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 18a040e5540..fc0e99fe4bb 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -486,6 +486,23 @@ unsigned MachineJumpTableInfo::getJumpTableIndex( return JumpTables.size()-1; } +/// ReplaceMBBInJumpTables - If Old is the target of any jump tables, update +/// the jump tables to branch to New instead. +bool +MachineJumpTableInfo::ReplaceMBBInJumpTables(MachineBasicBlock *Old, + MachineBasicBlock *New) { + assert(Old != New && "Not making a change?"); + bool MadeChange = false; + for (size_t i = 0, e = JumpTables.size(); i != e; ++i) { + MachineJumpTableEntry &JTE = JumpTables[i]; + for (size_t j = 0, e = JTE.MBBs.size(); j != e; ++j) + if (JTE.MBBs[j] == Old) { + JTE.MBBs[j] = New; + MadeChange = true; + } + } + return MadeChange; +} void MachineJumpTableInfo::print(std::ostream &OS) const { // FIXME: this is lame, maybe we could print out the MBB numbers or something |