1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Move MachineJumpTableInfo::ReplaceMBBInJumpTables out of line.

llvm-svn: 69125
This commit is contained in:
Dan Gohman 2009-04-15 01:18:49 +00:00
parent c9b68844d6
commit a885b48029
2 changed files with 19 additions and 14 deletions

View File

@ -67,19 +67,7 @@ public:
/// ReplaceMBBInJumpTables - If Old is the target of any jump tables, update /// ReplaceMBBInJumpTables - If Old is the target of any jump tables, update
/// the jump tables to branch to New instead. /// the jump tables to branch to New instead.
bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New) { bool 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;
}
/// getEntrySize - Returns the size of an individual field in a jump table. /// getEntrySize - Returns the size of an individual field in a jump table.
/// ///

View File

@ -486,6 +486,23 @@ unsigned MachineJumpTableInfo::getJumpTableIndex(
return JumpTables.size()-1; 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 { void MachineJumpTableInfo::print(std::ostream &OS) const {
// FIXME: this is lame, maybe we could print out the MBB numbers or something // FIXME: this is lame, maybe we could print out the MBB numbers or something