mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-12 16:25:18 +00:00
Tighten the insert() API for bundled instructions.
The normal insert() function takes an MBB::iterator position, and inserts a stand-alone MachineInstr as before. The insert() function that takes an MBB::instr_iterator position can insert instructions inside a bundle, and will now update the bundle flags correctly when that happens. When the insert position is between two bundles, it is unclear whether the instruction should be appended to the previous bundle, prepended to the next bundle, or stand on its own. The MBB::insert() function doesn't bundle the instruction in that case, use the MIBundleBuilder class for that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170437 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -814,6 +814,18 @@ MachineInstr *MachineBasicBlock::remove_instr(MachineInstr *MI) {
|
||||
return Insts.remove(MI);
|
||||
}
|
||||
|
||||
MachineBasicBlock::instr_iterator
|
||||
MachineBasicBlock::insert(instr_iterator I, MachineInstr *MI) {
|
||||
assert(!MI->isBundledWithPred() && !MI->isBundledWithSucc() &&
|
||||
"Cannot insert instruction with bundle flags");
|
||||
// Set the bundle flags when inserting inside a bundle.
|
||||
if (I != instr_end() && I->isBundledWithPred()) {
|
||||
MI->setFlag(MachineInstr::BundledPred);
|
||||
MI->setFlag(MachineInstr::BundledSucc);
|
||||
}
|
||||
return Insts.insert(I, MI);
|
||||
}
|
||||
|
||||
void MachineBasicBlock::splice(MachineBasicBlock::iterator where,
|
||||
MachineBasicBlock *Other,
|
||||
MachineBasicBlock::iterator From) {
|
||||
|
Reference in New Issue
Block a user