[PATCH] D78417: [SlotIndexes] Add insertion point for insertMBBIntoMaps
Carl Ritson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 17 23:07:28 PDT 2020
critson created this revision.
critson added reviewers: qcolombet, arsenm, kariddi, MaskRay, tpr.
Herald added subscribers: llvm-commits, arphaman, wdng, MatzeB.
Herald added a project: LLVM.
Allow the specification of an insertion point (MachineInstr)
for insertMBBIntoMaps.
This makes it possible to update slot indexes and live intervals
when trivially splitting a block by specifying the point of the
split as the insertion point for the block in the maps.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78417
Files:
llvm/include/llvm/CodeGen/LiveIntervals.h
llvm/include/llvm/CodeGen/SlotIndexes.h
Index: llvm/include/llvm/CodeGen/SlotIndexes.h
===================================================================
--- llvm/include/llvm/CodeGen/SlotIndexes.h
+++ llvm/include/llvm/CodeGen/SlotIndexes.h
@@ -604,14 +604,22 @@
}
/// Add the given MachineBasicBlock into the maps.
- void insertMBBInMaps(MachineBasicBlock *mbb) {
+ /// If \p InsertionPoint is specified then the block will be placed
+ /// before the given machine instr, otherwise it will be placed
+ /// immediately following the block's predecessor.
+ void insertMBBInMaps(MachineBasicBlock *mbb,
+ MachineInstr *InsertionPoint = nullptr) {
MachineFunction::iterator nextMBB =
std::next(MachineFunction::iterator(mbb));
IndexListEntry *startEntry = nullptr;
IndexListEntry *endEntry = nullptr;
IndexList::iterator newItr;
- if (nextMBB == mbb->getParent()->end()) {
+ if (InsertionPoint) {
+ startEntry = createEntry(nullptr, 0);
+ endEntry = getInstructionIndex(*InsertionPoint).listEntry();
+ newItr = indexList.insert(endEntry->getIterator(), startEntry);
+ } else if (nextMBB == mbb->getParent()->end()) {
startEntry = &indexList.back();
endEntry = createEntry(nullptr, 0);
newItr = indexList.insertAfter(startEntry->getIterator(), endEntry);
Index: llvm/include/llvm/CodeGen/LiveIntervals.h
===================================================================
--- llvm/include/llvm/CodeGen/LiveIntervals.h
+++ llvm/include/llvm/CodeGen/LiveIntervals.h
@@ -256,8 +256,9 @@
return Indexes->getMBBFromIndex(index);
}
- void insertMBBInMaps(MachineBasicBlock *MBB) {
- Indexes->insertMBBInMaps(MBB);
+ void insertMBBInMaps(MachineBasicBlock *MBB,
+ MachineInstr *InsertionPoint = nullptr) {
+ Indexes->insertMBBInMaps(MBB, InsertionPoint);
assert(unsigned(MBB->getNumber()) == RegMaskBlocks.size() &&
"Blocks must be added in order.");
RegMaskBlocks.push_back(std::make_pair(RegMaskSlots.size(), 0));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78417.258482.patch
Type: text/x-patch
Size: 2102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200418/771239a0/attachment.bin>
More information about the llvm-commits
mailing list