Skip to content

Commit 0efda51

Browse files
committed
[MachineInstrBuilder]: Add BuildMIAfter variant
Change-Id: Id60cc08a836bcc514b838e0782ddb9948dedf857
1 parent e6f360b commit 0efda51

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

llvm/include/llvm/CodeGen/MachineInstrBuilder.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,21 @@ inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB,
454454
.setMMRAMetadata(MIMD.getMMRAMetadata());
455455
}
456456

457+
/// This version of the builder inserts the newly-built instruction after the
458+
/// given position in the given MachineBasicBlock, and does NOT take a
459+
/// destination register.
460+
inline MachineInstrBuilder BuildMIAfter(MachineBasicBlock &BB,
461+
MachineBasicBlock::iterator I,
462+
const MIMetadata &MIMD,
463+
const MCInstrDesc &MCID) {
464+
MachineFunction &MF = *BB.getParent();
465+
MachineInstr *MI = MF.CreateMachineInstr(MCID, MIMD.getDL());
466+
BB.insertAfter(I, MI);
467+
return MachineInstrBuilder(MF, MI)
468+
.setPCSections(MIMD.getPCSections())
469+
.setMMRAMetadata(MIMD.getMMRAMetadata());
470+
}
471+
457472
inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB,
458473
MachineBasicBlock::instr_iterator I,
459474
const MIMetadata &MIMD,

0 commit comments

Comments
 (0)