[llvm-commits] [llvm] r125980 - in /llvm/trunk/lib/CodeGen: LiveRangeEdit.cpp LiveRangeEdit.h VirtRegMap.h
Jakob Stoklund Olesen
stoklund at 2pi.dk
Fri Feb 18 14:35:20 PST 2011
Author: stoklund
Date: Fri Feb 18 16:35:20 2011
New Revision: 125980
URL: http://llvm.org/viewvc/llvm-project?rev=125980&view=rev
Log:
Use VirtRegMap's Virt2SplitMap to keep track of the original live range before splitting.
All new virtual registers created for spilling or splitting point back to their original.
Modified:
llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp
llvm/trunk/lib/CodeGen/LiveRangeEdit.h
llvm/trunk/lib/CodeGen/VirtRegMap.h
Modified: llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp?rev=125980&r1=125979&r2=125980&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp Fri Feb 18 16:35:20 2011
@@ -19,12 +19,18 @@
using namespace llvm;
+unsigned LiveRangeEdit::getOriginal(const VirtRegMap &vrm) const {
+ unsigned Orig = vrm.getPreSplitReg(getReg());
+ return Orig ? Orig : getReg();
+}
+
LiveInterval &LiveRangeEdit::create(MachineRegisterInfo &mri,
LiveIntervals &lis,
VirtRegMap &vrm) {
- const TargetRegisterClass *RC = mri.getRegClass(parent_.reg);
+ const TargetRegisterClass *RC = mri.getRegClass(getReg());
unsigned VReg = mri.createVirtualRegister(RC);
vrm.grow();
+ vrm.setIsSplitFromReg(VReg, getOriginal(vrm));
LiveInterval &li = lis.getOrCreateInterval(VReg);
newRegs_.push_back(&li);
return li;
Modified: llvm/trunk/lib/CodeGen/LiveRangeEdit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeEdit.h?rev=125980&r1=125979&r2=125980&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveRangeEdit.h (original)
+++ llvm/trunk/lib/CodeGen/LiveRangeEdit.h Fri Feb 18 16:35:20 2011
@@ -73,6 +73,10 @@
LiveInterval &getParent() const { return parent_; }
unsigned getReg() const { return parent_.reg; }
+ /// getOriginal - Return the original virtual register that parent descends
+ /// from through splitting. The original was not created by splitting.
+ unsigned getOriginal(const VirtRegMap&) const;
+
/// Iterator for accessing the new registers added by this edit.
typedef SmallVectorImpl<LiveInterval*>::const_iterator iterator;
iterator begin() const { return newRegs_.begin()+firstNew_; }
Modified: llvm/trunk/lib/CodeGen/VirtRegMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.h?rev=125980&r1=125979&r2=125980&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/VirtRegMap.h (original)
+++ llvm/trunk/lib/CodeGen/VirtRegMap.h Fri Feb 18 16:35:20 2011
@@ -214,7 +214,7 @@
}
/// @brief returns the live interval virtReg is split from.
- unsigned getPreSplitReg(unsigned virtReg) {
+ unsigned getPreSplitReg(unsigned virtReg) const {
return Virt2SplitMap[virtReg];
}
More information about the llvm-commits
mailing list