mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-20 09:24:58 +00:00
Factor the numbering computation into a separate method, and add the slightest attempt at some renumbering logic, which is currently unused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51652 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d77d4f98fb
commit
80b3ce65e2
@ -306,6 +306,9 @@ namespace llvm {
|
|||||||
/// computeIntervals - Compute live intervals.
|
/// computeIntervals - Compute live intervals.
|
||||||
void computeIntervals();
|
void computeIntervals();
|
||||||
|
|
||||||
|
/// computeNumbering - Compute the index numbering.
|
||||||
|
void computeNumbering();
|
||||||
|
|
||||||
/// handleRegisterDef - update intervals for a register def
|
/// handleRegisterDef - update intervals for a register def
|
||||||
/// (calls handlePhysicalRegisterDef and
|
/// (calls handlePhysicalRegisterDef and
|
||||||
/// handleVirtualRegisterDef)
|
/// handleVirtualRegisterDef)
|
||||||
|
@ -75,17 +75,14 @@ void LiveIntervals::releaseMemory() {
|
|||||||
delete ClonedMIs[i];
|
delete ClonedMIs[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// runOnMachineFunction - Register allocate the whole function
|
void LiveIntervals::computeNumbering() {
|
||||||
///
|
Index2MiMap OldI2MI = i2miMap_;
|
||||||
bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
|
|
||||||
mf_ = &fn;
|
Idx2MBBMap.clear();
|
||||||
mri_ = &mf_->getRegInfo();
|
MBB2IdxMap.clear();
|
||||||
tm_ = &fn.getTarget();
|
mi2iMap_.clear();
|
||||||
tri_ = tm_->getRegisterInfo();
|
i2miMap_.clear();
|
||||||
tii_ = tm_->getInstrInfo();
|
|
||||||
lv_ = &getAnalysis<LiveVariables>();
|
|
||||||
allocatableRegs_ = tri_->getAllocatableSet(fn);
|
|
||||||
|
|
||||||
// Number MachineInstrs and MachineBasicBlocks.
|
// Number MachineInstrs and MachineBasicBlocks.
|
||||||
// Initialize MBB indexes to a sentinal.
|
// Initialize MBB indexes to a sentinal.
|
||||||
MBB2IdxMap.resize(mf_->getNumBlockIDs(), std::make_pair(~0U,~0U));
|
MBB2IdxMap.resize(mf_->getNumBlockIDs(), std::make_pair(~0U,~0U));
|
||||||
@ -110,7 +107,28 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
|
|||||||
Idx2MBBMap.push_back(std::make_pair(StartIdx, MBB));
|
Idx2MBBMap.push_back(std::make_pair(StartIdx, MBB));
|
||||||
}
|
}
|
||||||
std::sort(Idx2MBBMap.begin(), Idx2MBBMap.end(), Idx2MBBCompare());
|
std::sort(Idx2MBBMap.begin(), Idx2MBBMap.end(), Idx2MBBCompare());
|
||||||
|
|
||||||
|
if (!OldI2MI.empty())
|
||||||
|
for (iterator I = begin(), E = end(); I != E; ++I)
|
||||||
|
for (LiveInterval::iterator LI = I->second.begin(), LE = I->second.end();
|
||||||
|
LI != LE; ++LI) {
|
||||||
|
LI->start = mi2iMap_[OldI2MI[LI->start]];
|
||||||
|
LI->end = mi2iMap_[OldI2MI[LI->end]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// runOnMachineFunction - Register allocate the whole function
|
||||||
|
///
|
||||||
|
bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
|
||||||
|
mf_ = &fn;
|
||||||
|
mri_ = &mf_->getRegInfo();
|
||||||
|
tm_ = &fn.getTarget();
|
||||||
|
tri_ = tm_->getRegisterInfo();
|
||||||
|
tii_ = tm_->getInstrInfo();
|
||||||
|
lv_ = &getAnalysis<LiveVariables>();
|
||||||
|
allocatableRegs_ = tri_->getAllocatableSet(fn);
|
||||||
|
|
||||||
|
computeNumbering();
|
||||||
computeIntervals();
|
computeIntervals();
|
||||||
|
|
||||||
numIntervals += getNumIntervals();
|
numIntervals += getNumIntervals();
|
||||||
|
Loading…
Reference in New Issue
Block a user