Skip to content

Commit a9587c1

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 bf1b866 commit a9587c1

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
@@ -123,8 +123,9 @@ class MachineInstr
123123
NoUSWrap = 1 << 20, // Instruction supports geps
124124
// no unsigned signed wrap.
125125
SameSign = 1 << 21, // Both operands have the same sign.
126-
InBounds = 1 << 22 // Pointer arithmetic remains inbounds.
126+
InBounds = 1 << 22, // Pointer arithmetic remains inbounds.
127127
// Implies NoUSWrap.
128+
LRSplit = 1 << 23 // Instruction for live range split.
128129
};
129130

130131
private:

llvm/lib/CodeGen/SplitKit.cpp

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

534+
CopyMI->setFlag(MachineInstr::LRSplit);
534535
SlotIndexes &Indexes = *LIS.getSlotIndexes();
535536
if (FirstCopy) {
536537
Def = Indexes.insertMachineInstrInMaps(*CopyMI, Late).getRegSlot();
@@ -550,6 +551,7 @@ SlotIndex SplitEditor::buildCopy(Register FromReg, Register ToReg,
550551
// The full vreg is copied.
551552
MachineInstr *CopyMI =
552553
BuildMI(MBB, InsertBefore, DebugLoc(), Desc, ToReg).addReg(FromReg);
554+
CopyMI->setFlag(MachineInstr::LRSplit);
553555
return Indexes.insertMachineInstrInMaps(*CopyMI, Late).getRegSlot();
554556
}
555557

0 commit comments

Comments
 (0)