diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-03-11 21:34:46 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-03-11 21:34:46 +0000 |
commit | a3891365b52d3b7416d6d861a0aca2e64b72d212 (patch) | |
tree | 96affeea5b024fcaa61e2e56b815e1bc59da56fd /llvm/lib | |
parent | 44b4c07cd1e39acc1967e41b4b2620f809be5ba4 (diff) | |
download | bcm5719-llvm-a3891365b52d3b7416d6d861a0aca2e64b72d212.tar.gz bcm5719-llvm-a3891365b52d3b7416d6d861a0aca2e64b72d212.zip |
Transfer physical register spill info when load / store folding happens.
llvm-svn: 48246
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/CodeGen/VirtRegMap.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/CodeGen/VirtRegMap.h | 17 |
3 files changed, 20 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp index 79318043a62..d7c5544c366 100644 --- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -779,6 +779,7 @@ bool LiveIntervals::tryFoldMemoryOperand(MachineInstr* &MI, vrm.virtFolded(Reg, MI, fmi, (VirtRegMap::ModRef)MRInfo); vrm.transferSpillPts(MI, fmi); vrm.transferRestorePts(MI, fmi); + vrm.transferEmergencySpills(MI, fmi); mi2iMap_.erase(MI); i2miMap_[InstrIdx /InstrSlots::NUM] = fmi; mi2iMap_[fmi] = InstrIdx; diff --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp index cce36e51628..3b6612de4ff 100644 --- a/llvm/lib/CodeGen/VirtRegMap.cpp +++ b/llvm/lib/CodeGen/VirtRegMap.cpp @@ -35,6 +35,7 @@ using namespace llvm; STATISTIC(NumSpills, "Number of register spills"); +STATISTIC(NumPSpills,"Number of physical register spills"); STATISTIC(NumReMats, "Number of re-materialization"); STATISTIC(NumDRM , "Number of re-materializable defs elided"); STATISTIC(NumStores, "Number of stores added"); @@ -1079,7 +1080,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM) { TII->loadRegFromStackSlot(MBB, next(MII), PhysReg, SS, RC); MachineInstr *LoadMI = next(MII); VRM.addSpillSlotUse(SS, LoadMI); - ++NumSpills; + ++NumPSpills; } } diff --git a/llvm/lib/CodeGen/VirtRegMap.h b/llvm/lib/CodeGen/VirtRegMap.h index 7ebf31eeff3..63d5b87b26b 100644 --- a/llvm/lib/CodeGen/VirtRegMap.h +++ b/llvm/lib/CodeGen/VirtRegMap.h @@ -268,6 +268,8 @@ namespace llvm { } } + /// @brief - transfer spill point information from one instruction to + /// another. void transferSpillPts(MachineInstr *Old, MachineInstr *New) { std::map<MachineInstr*,std::vector<std::pair<unsigned,bool> > >::iterator I = SpillPt2VirtMap.find(Old); @@ -343,6 +345,21 @@ namespace llvm { return EmergencySpillMap[MI]; } + /// @brief - transfer emergency spill information from one instruction to + /// another. + void transferEmergencySpills(MachineInstr *Old, MachineInstr *New) { + std::map<MachineInstr*,std::vector<unsigned> >::iterator I = + EmergencySpillMap.find(Old); + if (I == EmergencySpillMap.end()) + return; + while (!I->second.empty()) { + unsigned virtReg = I->second.back(); + I->second.pop_back(); + addEmergencySpill(virtReg, New); + } + EmergencySpillMap.erase(I); + } + /// @brief return or get a emergency spill slot for the register class. int getEmergencySpillSlot(const TargetRegisterClass *RC); |