Skip to content

Commit 90f830f

Browse files
committed
[CodeGen] Introduce MI flag for Live Range split instructions
For some targets, it is required to identify the COPY instruction corresponds to the RA inserted live range split. Adding the new flag `MachineInstr::LRSplit` to serve the purpose.
1 parent ff7b42c commit 90f830f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

llvm/include/llvm/CodeGen/MachineInstr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ class MachineInstr
119119
Disjoint = 1 << 19, // Each bit is zero in at least one of the inputs.
120120
NoUSWrap = 1 << 20, // Instruction supports geps
121121
// no unsigned signed wrap.
122-
SameSign = 1 << 21 // Both operands have the same sign.
122+
SameSign = 1 << 21, // Both operands have the same sign.
123+
LRSplit = 1 << 22 // Instruction for live range split.
123124
};
124125

125126
private:

llvm/lib/CodeGen/SplitKit.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ SlotIndex SplitEditor::buildSingleSubRegCopy(
533533
| getInternalReadRegState(!FirstCopy), SubIdx)
534534
.addReg(FromReg, 0, SubIdx);
535535

536+
CopyMI->setFlag(MachineInstr::LRSplit);
536537
SlotIndexes &Indexes = *LIS.getSlotIndexes();
537538
if (FirstCopy) {
538539
Def = Indexes.insertMachineInstrInMaps(*CopyMI, Late).getRegSlot();
@@ -552,6 +553,7 @@ SlotIndex SplitEditor::buildCopy(Register FromReg, Register ToReg,
552553
// The full vreg is copied.
553554
MachineInstr *CopyMI =
554555
BuildMI(MBB, InsertBefore, DebugLoc(), Desc, ToReg).addReg(FromReg);
556+
CopyMI->setFlag(MachineInstr::LRSplit);
555557
return Indexes.insertMachineInstrInMaps(*CopyMI, Late).getRegSlot();
556558
}
557559

0 commit comments

Comments
 (0)