mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 00:24:26 +00:00
Add function to replace a destination MBB in a single jump table
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88804 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -69,6 +69,11 @@ public:
|
|||||||
/// 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);
|
||||||
|
|
||||||
|
/// ReplaceMBBInJumpTable - If Old is a target of the jump tables, update
|
||||||
|
/// the jump table to branch to New instead.
|
||||||
|
bool ReplaceMBBInJumpTable(unsigned Idx, MachineBasicBlock *Old,
|
||||||
|
MachineBasicBlock *New);
|
||||||
|
|
||||||
/// getEntrySize - Returns the size of an individual field in a jump table.
|
/// getEntrySize - Returns the size of an individual field in a jump table.
|
||||||
///
|
///
|
||||||
unsigned getEntrySize() const { return EntrySize; }
|
unsigned getEntrySize() const { return EntrySize; }
|
||||||
|
@ -545,14 +545,25 @@ MachineJumpTableInfo::ReplaceMBBInJumpTables(MachineBasicBlock *Old,
|
|||||||
MachineBasicBlock *New) {
|
MachineBasicBlock *New) {
|
||||||
assert(Old != New && "Not making a change?");
|
assert(Old != New && "Not making a change?");
|
||||||
bool MadeChange = false;
|
bool MadeChange = false;
|
||||||
for (size_t i = 0, e = JumpTables.size(); i != e; ++i) {
|
for (size_t i = 0, e = JumpTables.size(); i != e; ++i)
|
||||||
MachineJumpTableEntry &JTE = JumpTables[i];
|
ReplaceMBBInJumpTable(i, Old, New);
|
||||||
for (size_t j = 0, e = JTE.MBBs.size(); j != e; ++j)
|
return MadeChange;
|
||||||
if (JTE.MBBs[j] == Old) {
|
}
|
||||||
JTE.MBBs[j] = New;
|
|
||||||
MadeChange = true;
|
/// ReplaceMBBInJumpTable - If Old is a target of the jump tables, update
|
||||||
}
|
/// the jump table to branch to New instead.
|
||||||
}
|
bool
|
||||||
|
MachineJumpTableInfo::ReplaceMBBInJumpTable(unsigned Idx,
|
||||||
|
MachineBasicBlock *Old,
|
||||||
|
MachineBasicBlock *New) {
|
||||||
|
assert(Old != New && "Not making a change?");
|
||||||
|
bool MadeChange = false;
|
||||||
|
MachineJumpTableEntry &JTE = JumpTables[Idx];
|
||||||
|
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;
|
return MadeChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user