diff options
| author | Christudasan Devadasan <Christudasan.Devadasan@amd.com> | 2024-11-14 14:11:44 +0530 |
|---|---|---|
| committer | Christudasan Devadasan <Christudasan.Devadasan@amd.com> | 2025-11-07 11:09:32 +0530 |
| commit | a9587c1342ff0748ca19c6f35913365d09b9a635 (patch) | |
| tree | cce3fecea71b65fa4ff09971c3f1f480baaa3d59 | |
| parent | bf1b86698b41fcfa6875b668e8df8ea6d81081e5 (diff) | |
[CodeGen] Introduce MI flag for Live Range split instructionsusers/cdevadas/mi-flag-for-lr-split-insn
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.
| -rw-r--r-- | llvm/include/llvm/CodeGen/MachineInstr.h | 3 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/SplitKit.cpp | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h index 4fcb7f36e023..c270e8d1fb38 100644 --- a/llvm/include/llvm/CodeGen/MachineInstr.h +++ b/llvm/include/llvm/CodeGen/MachineInstr.h @@ -123,8 +123,9 @@ public: NoUSWrap = 1 << 20, // Instruction supports geps // no unsigned signed wrap. SameSign = 1 << 21, // Both operands have the same sign. - InBounds = 1 << 22 // Pointer arithmetic remains inbounds. + InBounds = 1 << 22, // Pointer arithmetic remains inbounds. // Implies NoUSWrap. + LRSplit = 1 << 23 // Instruction for live range split. }; private: diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp index f9ecb2c97b2e..589b9ca39d63 100644 --- a/llvm/lib/CodeGen/SplitKit.cpp +++ b/llvm/lib/CodeGen/SplitKit.cpp @@ -531,6 +531,7 @@ SlotIndex SplitEditor::buildSingleSubRegCopy( | getInternalReadRegState(!FirstCopy), SubIdx) .addReg(FromReg, 0, SubIdx); + CopyMI->setFlag(MachineInstr::LRSplit); SlotIndexes &Indexes = *LIS.getSlotIndexes(); if (FirstCopy) { Def = Indexes.insertMachineInstrInMaps(*CopyMI, Late).getRegSlot(); @@ -550,6 +551,7 @@ SlotIndex SplitEditor::buildCopy(Register FromReg, Register ToReg, // The full vreg is copied. MachineInstr *CopyMI = BuildMI(MBB, InsertBefore, DebugLoc(), Desc, ToReg).addReg(FromReg); + CopyMI->setFlag(MachineInstr::LRSplit); return Indexes.insertMachineInstrInMaps(*CopyMI, Late).getRegSlot(); } |
