mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
Number SlotIndexes uniformly without looking at the number of defs on each instruction.
You can't really predict how many indexes will be needed from the number of defs, so let's keep it simple. Also remove an extra empty index that was inserted after each basic block. It was intended for live-out ranges, but it was never used that way. llvm-svn: 127014
This commit is contained in:
parent
61af2752b1
commit
d99d8cfdf0
@ -75,8 +75,6 @@ bool SlotIndexes::runOnMachineFunction(MachineFunction &fn) {
|
|||||||
// Insert an index for the MBB start.
|
// Insert an index for the MBB start.
|
||||||
SlotIndex blockStartIndex(back(), SlotIndex::LOAD);
|
SlotIndex blockStartIndex(back(), SlotIndex::LOAD);
|
||||||
|
|
||||||
index += SlotIndex::NUM;
|
|
||||||
|
|
||||||
for (MachineBasicBlock::iterator miItr = mbb->begin(), miEnd = mbb->end();
|
for (MachineBasicBlock::iterator miItr = mbb->begin(), miEnd = mbb->end();
|
||||||
miItr != miEnd; ++miItr) {
|
miItr != miEnd; ++miItr) {
|
||||||
MachineInstr *mi = miItr;
|
MachineInstr *mi = miItr;
|
||||||
@ -84,27 +82,16 @@ bool SlotIndexes::runOnMachineFunction(MachineFunction &fn) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Insert a store index for the instr.
|
// Insert a store index for the instr.
|
||||||
push_back(createEntry(mi, index));
|
push_back(createEntry(mi, index += SlotIndex::InstrDist));
|
||||||
|
|
||||||
// Save this base index in the maps.
|
// Save this base index in the maps.
|
||||||
mi2iMap.insert(
|
mi2iMap.insert(std::make_pair(mi, SlotIndex(back(), SlotIndex::LOAD)));
|
||||||
std::make_pair(mi, SlotIndex(back(), SlotIndex::LOAD)));
|
|
||||||
|
|
||||||
++functionSize;
|
++functionSize;
|
||||||
|
|
||||||
unsigned Slots = mi->getDesc().getNumDefs();
|
|
||||||
if (Slots == 0)
|
|
||||||
Slots = 1;
|
|
||||||
|
|
||||||
index += (Slots + 1) * SlotIndex::NUM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We insert two blank instructions between basic blocks.
|
// We insert one blank instructions between basic blocks.
|
||||||
// One to represent live-out registers and one to represent live-ins.
|
push_back(createEntry(0, index += SlotIndex::InstrDist));
|
||||||
push_back(createEntry(0, index));
|
|
||||||
index += SlotIndex::NUM;
|
|
||||||
|
|
||||||
push_back(createEntry(0, index));
|
|
||||||
|
|
||||||
SlotIndex blockEndIndex(back(), SlotIndex::LOAD);
|
SlotIndex blockEndIndex(back(), SlotIndex::LOAD);
|
||||||
mbb2IdxMap.insert(
|
mbb2IdxMap.insert(
|
||||||
@ -123,13 +110,7 @@ bool SlotIndexes::runOnMachineFunction(MachineFunction &fn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SlotIndexes::renumberIndexes() {
|
void SlotIndexes::renumberIndexes() {
|
||||||
|
|
||||||
// Renumber updates the index of every element of the index list.
|
// Renumber updates the index of every element of the index list.
|
||||||
// If all instrs in the function have been allocated an index (which has been
|
|
||||||
// placed in the index list in the order of instruction iteration) then the
|
|
||||||
// resulting numbering will match what would have been generated by the
|
|
||||||
// pass during the initial numbering of the function if the new instructions
|
|
||||||
// had been present.
|
|
||||||
DEBUG(dbgs() << "\n*** Renumbering SlotIndexes ***\n");
|
DEBUG(dbgs() << "\n*** Renumbering SlotIndexes ***\n");
|
||||||
++NumRenumPasses;
|
++NumRenumPasses;
|
||||||
|
|
||||||
@ -138,7 +119,7 @@ void SlotIndexes::renumberIndexes() {
|
|||||||
for (IndexListEntry *curEntry = front(); curEntry != getTail();
|
for (IndexListEntry *curEntry = front(); curEntry != getTail();
|
||||||
curEntry = curEntry->getNext()) {
|
curEntry = curEntry->getNext()) {
|
||||||
curEntry->setIndex(index);
|
curEntry->setIndex(index);
|
||||||
index += 4*SlotIndex::NUM;
|
index += SlotIndex::InstrDist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user